You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Martin Farrell <Ma...@emap.com> on 2001/06/21 14:12:28 UTC
Parsing xml
Hi
I have a method that will create an xml output (a.toXML()) as a String. Now
my problem is that I would like to parse this String directly, and reduce
the overhead of file creation in my application
Does anyone have an idea of how i could achieve this?
Thanks
Martin
--------------------------------------------------------------------------------
The information in this email is intended only for the addressee(s) named above.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient of this message any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be unlawful.
Emap plc and or its subsidiaries do not warrant that any attachments are free from
viruses or other defects and accept no liability for any losses resulting from
infected email transmissions.
Please note that any views expressed in this email may be those of the originator
and do not necessarily reflect those of this organisation.
--------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: Parsing xml
Posted by Petr Kuzel <Pe...@sun.com>.
Ian Roberts wrote:
>
> On Thu, 21 Jun 2001, Martin Farrell wrote:
>
> > I have a method that will create an xml output (a.toXML()) as a String. Now
> > my problem is that I would like to parse this String directly, and reduce
> > the overhead of file creation in my application
>
> Create a parser instance, set up the appropriate features and then call:
>
> parser.parse(new InputSource(new StringReader(a.toXML())));
An improvement to avoid unexpected NullPointerExceptions:
InputSource in = new InputSource(new StringReader(a.toXML()));
in.setSystemId("non null");
parser.parse(in);
Cc.
--
<address>
<a href="mailto:pkuzel@sun.com">Petr Kuzel</a>, Sun Microsystems
: <a href="http://www.sun.com/forte/ffj/ie/">Forte Tools</a>
: XML and <a href="http://jini.netbeans.org/">Jini</a> modules</address>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: Parsing xml
Posted by Ian Roberts <ir...@decisionsoft.com>.
On Thu, 21 Jun 2001, Martin Farrell wrote:
> I have a method that will create an xml output (a.toXML()) as a String. Now
> my problem is that I would like to parse this String directly, and reduce
> the overhead of file creation in my application
Create a parser instance, set up the appropriate features and then call:
parser.parse(new InputSource(new StringReader(a.toXML())));
Ian
--
Ian Roberts, Software Engineer DecisionSoft Ltd.
Telephone: +44-1865-203192 http://www.decisionsoft.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org