Java, UnmarshallingException caused by XML attribute with special chars: ;ìè+òàù-<^èç°§_>!£$%&/()=?~
- by segolas
Hi,
my xml file has a tag with an attribute "containsValue" which contains the "special" characters you can see in the subject:
<original_msg_body id="msgBodySpecialCharsRule" containsValue=";ìè+òàù-<^èç°§_>!£$%&/()=?~`'#;" />
in my xml schema the attribute has xs:string:
<xs:attribute name="containsValue" type="xs:string" />
I use this value inside a Java software which check if this value is contained inside another String.
but I always obtain this Exception:
javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: The value of attribute "containsValue" associated with an element type "original_msg_body" must not contain the '<' character.]
How can I solve it? I've tried changing the attribute type to xs:NMTOKEN, ut I get the same exception. Is there any other type?
I think I could change the characters encoding, for example using the HTML representation, like <, but than could be tricky for the string comparison...