Hi Folks, I am writing an application in Java using DOM API. I have done the parsing of an XML document by passing its file name as a String parameter to the parse method of DOMParser class. This woks fine. Now, I would like to pass the XML documentas a String and parse. Please help me doing this task. Regards, Lakshmi
In order to parse an XML string, you will need to use an InputSource instance. Try this -
Hope that helps! ------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. IBM Certified Developer - XML and Related Technologies, V1.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Joined: Jun 26, 2001
Thank you Ajith, I am currently using ByteArrayInputStream object as a parameter to InputSource constructor. I will try with StringBufferInputStream now. But otherwise, instead of using InputSource, is there any way of sending XML String for parsing ! Please let me Know. Regards, Lakshmi [This message has been edited by Lakshmi Ramachandran (edited July 17, 2001).] [This message has been edited by Lakshmi Ramachandran (edited July 17, 2001).]
Hello, i was trying to do what u had suggested for parsing an xml string,but the compiler says C:\Mahesh\BlueEdge>javac -deprecation testxml.java testxml.java:73: warning: java.io.StringBufferInputStream in java.io has been deprecated InputStream is = new StringBufferInputStream(xmldata) ; ^ 1 warning any ideas what i should be using instead Thanks, Mahesh
Originally posted by Ajith Kallambella: [B]In order to parse an XML string, you will need to use an InputSource instance. Try this -