This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
How do I parse an XML, which is stored in a String? Assume the string name is xmlString. It contains 'employee' as root node and firstname, lasename, address as child node.
I tried the following with xml4J parser. 1. Create a parser object Parser p = new Parser("parser.err"); 2. converting a string into an inputstream. ByteArrayInputStream is = new ByteArrayInputStream(xmlString.getBytes());
3. Create the DOM tree TXDocument document = parser.readStream(is); here, document(DOM tree) is null. So, I am not able to get the root element. Why is that??? Thanks