Re: DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash!



Ed wrote:
In my code below, I do have a XML String which has NodeName made of
two words split by a Forward Slash. Here it is: Number/Subsystem.

Is there anyway to make the DocumentBuilder object to parse XML String
and the Forward Slash, successfully?
I added this like of the code but it's not working:

XMLString = XMLString.replaceAll("Number/Subsystem","Number\"/
\"Subsystem");


Here is my code below:
------------------------------------


String XMLString = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"

+"<computerPart>"
+"<Number/Subsystem>9</Number/Subsystem>"
+"</computerPart>";

XMLString = XMLString.replaceAll("Number/Subsystem","Number\"/
\"Subsystem");

/ is not valid in XML names - see:
http://www.w3.org/TR/REC-xml/#NT-Name

I do not understand your replace.

Do you mean:

XMLString = XMLString.replaceAll("Number/Subsystem","Number.Subsystem");

?

Arne


.



Relevant Pages