1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
package org.apache.camel.component.validator.relaxng; |
19 |
|
|
20 |
|
import org.apache.camel.component.validator.ValidatorComponent; |
21 |
|
import org.apache.camel.component.validator.SpringValidator; |
22 |
|
import org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl; |
23 |
|
import org.iso_relax.verifier.VerifierConfigurationException; |
24 |
|
|
25 |
|
import javax.xml.XMLConstants; |
26 |
|
import java.util.Map; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
0 |
public class RelaxNGComponent extends ValidatorComponent { |
32 |
|
private RELAXNGSchemaFactoryImpl schemaFactory; |
33 |
|
|
34 |
|
public RELAXNGSchemaFactoryImpl getSchemaFactory() throws VerifierConfigurationException { |
35 |
0 |
if (schemaFactory == null) { |
36 |
0 |
schemaFactory = new RELAXNGSchemaFactoryImpl(); |
37 |
|
} |
38 |
0 |
return schemaFactory; |
39 |
|
} |
40 |
|
|
41 |
|
public void setSchemaFactory(RELAXNGSchemaFactoryImpl schemaFactory) { |
42 |
0 |
this.schemaFactory = schemaFactory; |
43 |
0 |
} |
44 |
|
|
45 |
|
protected void configureValidator(SpringValidator validator, String uri, String remaining, Map parameters) throws Exception { |
46 |
0 |
validator.setSchemaLanguage(XMLConstants.RELAXNG_NS_URI); |
47 |
0 |
validator.setSchemaFactory(schemaFactory); |
48 |
0 |
super.configureValidator(validator, uri, remaining, parameters); |
49 |
0 |
} |
50 |
|
} |