After an upgrade from JRules to ODM we are receiving errors because of an ampersand in our data. This used to work before.
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: The reference to entity "NIGHT" must end with the ; delimiter.
Answer by EricCharpentier (4399) | Feb 12, 2016 at 10:24 AM
The error you are receiving:
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: The reference to entity "NIGHT" must end with the ; delimiter.
is essentially confirming that there is an issue with the ampersand located in the data and preceding the "NIGHT" because your data is "DAY&NIGHT".
The ampersand is in fact a special character in XML. Occurrences of the
ampersand need to be substituted with &
in order for the XML parser to
be able to process the information properly.
In fact, there are a total of 5 characters that need special treatment:
<
(<), &
(&), >
(>), "
("), and '
(').
You can perform this substitution yourself before making the call to the rule service, but it does make the XML a bit harder to read for users.
The alternative to this is to wrap the specific fields that might contain special characters into a CDATA field.
The following technote explains this (although it point to older version of JRules and ODM):
http://www-01.ibm.com/support/docview.wss?uid=swg21498780
You can also read more about CDATA here:
http://www.ibm.com/developerworks/library/x-cdata/
The differences in behavior between JRules and ODM can be explained by the use of different (or different versions) of XML Parser libraries.