xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Dodd <AnthonyD...@synergy-fs.com>
Subject RE: String to Document using Xerces 1.0.3
Date Thu, 24 Aug 2000 07:52:41 GMT
Hi Matt

   Is the following code fragment of any help

  org.apache.xerces.parsers.DOMParser parser = new

  public Document parseXML(String xmlString) throws Exception {
    //Create a new Reader Object
    java.io.StringReader xmlReader = new java.io.StringReader(xmlString);
    //Create a new InputSource from the reader object and parse it
    parser.parse(new InputSource(xmlReader));
    return parser.getDocument();

Tony Dodd

-----Original Message-----
From: MMcBride@therealm.com [mailto:MMcBride@therealm.com]
Sent: 23 August 2000 16:36
To: XML-INTEREST@JAVA.SUN.COM; general@xml.apache.org
Subject: String to Document using Xerces 1.0.3

I am attempting to read a string (myXML) containing XML into a document
without storing it in a file.  Ultimately, I will need to parse the
document with the DOMParser from Xerces 1.0.3.

Here is a fragment of what I have so far:

DOMParser myParser = new DOMParser();
document = myParser.getDocument();

Now, the DOMParser parse method only takes an InputSource parameter.  I
think my question is "how can I take the string into an InputSource
parameter?"  However, if there is another way of doing this, please feel
free to pass it along!  Thanks for the help...



In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message