Hello,
I have an XML string as Input to a service.
The XML contains a string which has ‘&’ [ampersand] in it.
Example: Engineering & Management Services
I am converting this XML String to Node (using pub.xml:xmlStringToXMLNode) and then to Document ( using pub.xml:xmlNodeToDocument).
While converting to Document, I am getting the below error:
I have tried using encoding = UTF-8 and UTF-16 but got the same results.
For debugging purpose, when I change the “&” to “&” in the source XML string then it works perfectly, but as a solution this cannot be taken, as no change in source XML is allowed.
Any suggestion for this solution is really appreciated.
Hi Soumodip,
In the xsd of this xml for this particular field you can define accepted special character. Once you define then it should not throw this error.
The above scenario is an invalid xml character according to XML 1.0 Spec, so if possible tell the source to send with a valid html character(& as you mentioned).
If not set the below watt property to disable validation.
watt.server.xml.enforceEntityRef=false
The source MUST change the XML to convert & (and other specific characters used for markup) to the proper entity character. E.g. change & and &. It is not valid XML otherwise and there is nothing that you should do on your side to accomodate that invalid XML.
I m also facing the same error in my code .Source is sending the XML with &.
As per nitesh i set the below property,
watt.server.xml.enforceEntityRef=false
But still getting the same error.Source is not able to correct this.Since webMethods needs to allow this special charaters in the xml.Any one please suggest.
yea.i tried that,but it looks like whole xml format got changed.i m getting the error while converting XML to node service ,since it is not able to recognize the ‘&’ .so it is failing.
I already did that ,it is passing the node to document service without any error,But looks like document getting generated as empty and also it is not an understandable format,
and as you said we unable to replace the & with & as source is only sending the XML data with ‘&’
However we have to accept special character & from source in any case without changing the XML.