Reputation: 3
I have xml with a tag name that contains '&' like D&G . This xml is being validated against a XSD that has element definition for nm as below
<xs:element maxOccurs="1" minOccurs="0" name="nm" type="Max70Text"/>
<xs:simpleType name="Max70Text">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="70"/>
</xs:restriction>
</xs:simpleType>
in the code ....
InputStream is = new FileInputStream(l_file);
InputStreamReader isr = new InputStreamReader(is,"UTF-8");
Source source = new StreamSource(isr);
schemaValidator.validate(source);
... i get SAX Error after the validate method is executed. How can i avoid this exception and make ampersand skip the validation.
Thanks in advance.
Upvotes: 0
Views: 2963
Reputation: 601
According to "Extensible Markup Language (XML) 1.1" (http://www.w3.org/TR/xml11/#NT-Name) '&' character is not a valid character for the element name.
Upvotes: 1