[英]XSD Schema Validation Error : must not contain the '<' character
我的 XSD 文件:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sample">
<xs:complexType>
<xs:attribute type="xs:string" name="synopsis"/>
<xs:attribute type="xs:string" name="genre"/>
</xs:complexType>
</xs:element>
</xs:schema>
XML文件:
<asset
synopsis="A romantic affair.<br><br>Contains one use of stronand moderate sex<br><br>Buy it" genre="Drama"/>
代码:
// javax.xml.validation.Validator;
validator.validate(new StreamSource(new ByteArrayInputStream(xmlContent.getBytes(UTF_8))));
得到以下错误:
java.lang.AssertionError: XML Validation Error :The value of attribute "synopsis" associated with an element type "asset" must not contain the '<' character.
任何线索如何在 xml 属性值中允许<
和>
字符?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.