You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Ji Li <ji...@sybergen.com> on 2000/07/11 20:13:15 UTC
how to parse a XML stream?
now, I write a program which need to parse a buffer(not a file). the data
in the buffer is XML format. I am not sure how to do it, I fund there a
Inputsource class in Xerce, but I am not know how to use it and can not find
a sample:(, who can help me on this, thanks very much.
btw, my xerce version is 1.10
B.R.
jil
Re: how to parse a XML stream?
Posted by Arundhati Bhowmick <ar...@hyperreal.org>.
Should be "us-ascii"
Marat Ruvinov wrote:
> Regarding this in memory processing of xml streams, I have an in memory
> stream of
> "<?xml version='1.0' encoding=ascii?><foo>someText</foo>"
>
> used (and declared with ascii encoding) as in samples/MemParse
>
> When it tries to parse the above, I get the following exception thrown
> "Message: could not create a converter for encoding: ascii"
>
> Anyone have an idea as to why ?
>
> Marat
>
> Joe Polastre wrote:
>
> > Please check out the MemBufInputSource class in
> > <framework/MemBufInputSource.hpp>
> >
> > The syntax of the MemBufInputSource is very similar to the StdInInputSource
> > which has a sample application included with Xerces: stdinparse
> >
> > simply create a new imput source:
> >
> > DOMParser* parser = new DOMParser();
> > XMLByte* charbuf = /*your buffer*/
> > MemBufInputSource* memorybuffer =
> > new MemBufInputSource(charbuf, length(charbuf), sysId, adopt);
> > // sysId and adopt are options you set as per the API documentation
> > // set errorhandlers etc here...
> > parser->parse(memorybuffer);
> >
> > Hope this helps. Something like this should really be in the faq too (it
> > used to be in the xerces-J faq)
> >
> > -Joe Polastre (jpolast@apache.org)
> > IBM Cupertino, XML Technology Group
> >
> > ----- Original Message -----
> > From: "Ji Li" <ji...@sybergen.com>
> > To: <xe...@xml.apache.org>
> > Sent: Tuesday, July 11, 2000 11:13 AM
> > Subject: how to parse a XML stream?
> >
> > > now, I write a program which need to parse a buffer(not a file). the data
> > > in the buffer is XML format. I am not sure how to do it, I fund there a
> > > Inputsource class in Xerce, but I am not know how to use it and can not
> > find
> > > a sample:(, who can help me on this, thanks very much.
> > >
> > > btw, my xerce version is 1.10
> > >
> > > B.R.
> > > jil
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: how to parse a XML stream?
Posted by Marat Ruvinov <Ma...@msdw.com>.
It's a typo in my email.. I did have quotes around ascii :
"<?xml version='1.0' encoding='ascii'?><foo>someText</foo>
Marat
Radovan Chytracek wrote:
> > Regarding this in memory processing of xml streams, I have an in memory
> > stream of
> > "<?xml version='1.0' encoding=ascii?><foo>someText</foo>"
> >
> > used (and declared with ascii encoding) as in samples/MemParse
> >
> > When it tries to parse the above, I get the following exception thrown
> > "Message: could not create a converter for encoding: ascii"
> Shouldn't be the memory stream as
>
> "<?xml version='1.0' encoding='ascii'?><foo>someText</foo>"
>
> ???
>
> Note the missing quotes around "ascii" string.
>
> Radovan
Re: how to parse a XML stream?
Posted by Radovan Chytracek <Ra...@cern.ch>.
> Regarding this in memory processing of xml streams, I have an in memory
> stream of
> "<?xml version='1.0' encoding=ascii?><foo>someText</foo>"
>
> used (and declared with ascii encoding) as in samples/MemParse
>
> When it tries to parse the above, I get the following exception thrown
> "Message: could not create a converter for encoding: ascii"
Shouldn't be the memory stream as
"<?xml version='1.0' encoding='ascii'?><foo>someText</foo>"
???
Note the missing quotes around "ascii" string.
Radovan
Re: how to parse a XML stream?
Posted by Marat Ruvinov <Ma...@msdw.com>.
Regarding this in memory processing of xml streams, I have an in memory
stream of
"<?xml version='1.0' encoding=ascii?><foo>someText</foo>"
used (and declared with ascii encoding) as in samples/MemParse
When it tries to parse the above, I get the following exception thrown
"Message: could not create a converter for encoding: ascii"
Anyone have an idea as to why ?
Marat
Joe Polastre wrote:
> Please check out the MemBufInputSource class in
> <framework/MemBufInputSource.hpp>
>
> The syntax of the MemBufInputSource is very similar to the StdInInputSource
> which has a sample application included with Xerces: stdinparse
>
> simply create a new imput source:
>
> DOMParser* parser = new DOMParser();
> XMLByte* charbuf = /*your buffer*/
> MemBufInputSource* memorybuffer =
> new MemBufInputSource(charbuf, length(charbuf), sysId, adopt);
> // sysId and adopt are options you set as per the API documentation
> // set errorhandlers etc here...
> parser->parse(memorybuffer);
>
> Hope this helps. Something like this should really be in the faq too (it
> used to be in the xerces-J faq)
>
> -Joe Polastre (jpolast@apache.org)
> IBM Cupertino, XML Technology Group
>
> ----- Original Message -----
> From: "Ji Li" <ji...@sybergen.com>
> To: <xe...@xml.apache.org>
> Sent: Tuesday, July 11, 2000 11:13 AM
> Subject: how to parse a XML stream?
>
> > now, I write a program which need to parse a buffer(not a file). the data
> > in the buffer is XML format. I am not sure how to do it, I fund there a
> > Inputsource class in Xerce, but I am not know how to use it and can not
> find
> > a sample:(, who can help me on this, thanks very much.
> >
> > btw, my xerce version is 1.10
> >
> > B.R.
> > jil
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: how to parse a XML stream?
Posted by Joe Polastre <jp...@apache.org>.
Please check out the MemBufInputSource class in
<framework/MemBufInputSource.hpp>
The syntax of the MemBufInputSource is very similar to the StdInInputSource
which has a sample application included with Xerces: stdinparse
simply create a new imput source:
DOMParser* parser = new DOMParser();
XMLByte* charbuf = /*your buffer*/
MemBufInputSource* memorybuffer =
new MemBufInputSource(charbuf, length(charbuf), sysId, adopt);
// sysId and adopt are options you set as per the API documentation
// set errorhandlers etc here...
parser->parse(memorybuffer);
Hope this helps. Something like this should really be in the faq too (it
used to be in the xerces-J faq)
-Joe Polastre (jpolast@apache.org)
IBM Cupertino, XML Technology Group
----- Original Message -----
From: "Ji Li" <ji...@sybergen.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, July 11, 2000 11:13 AM
Subject: how to parse a XML stream?
> now, I write a program which need to parse a buffer(not a file). the data
> in the buffer is XML format. I am not sure how to do it, I fund there a
> Inputsource class in Xerce, but I am not know how to use it and can not
find
> a sample:(, who can help me on this, thanks very much.
>
> btw, my xerce version is 1.10
>
> B.R.
> jil
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>