DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash!
- From: Ed <arub11@xxxxxxxxx>
- Date: Wed, 01 Aug 2007 14:37:42 -0700
Hi All,
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");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException ex7) {
}
Document XMLStringToDOM= null;
try {
XMLStringToDOM = builder.parse(new InputSource(new
StringReader(XMLString.toString())));
} catch (IOException ex8) {
} catch (SAXException ex8) {
}
.
- Follow-Ups:
- Prev by Date: Re: Java 7 features
- Next by Date: Re: Class.getMethod in class's static initializer block
- Previous by thread: Urgent Opening for System Analyst/Administrator,6months+Santa Clara, CA
- Next by thread: Re: DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash!
- Index(es):