You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by MM...@therealm.com on 2000/08/23 17:35:52 UTC

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();
...
myParser.parse(???myXML???);
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...

Regards.

Matt


Re: String to Document using Xerces 1.0.3

Posted by Joe Sabu <Jo...@dothill.com>.
I guess you can construct an InputSource from a String

for e.g.,InputSource ip = new InputSource(new StringReader(your-string-here)

Is this what you wanted?
JS

----- Original Message -----
From: <MM...@therealm.com>
To: <XM...@JAVA.SUN.COM>; <ge...@xml.apache.org>
Sent: Wednesday, August 23, 2000 11:35 AM
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();
...
myParser.parse(???myXML???);
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...

Regards.

Matt


---------------------------------------------------------------------
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