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 "Purdy, Edgar M" <ed...@lmco.com> on 2004/01/14 15:11:32 UTC

XML buffer parser help

I need to parse a buffer.

I have a working Xerces DOM parser in c++ that parses an XML document.  
I have to migrate that parser to work with a buffer only. I have to pull value pairs out of the XML.  The nodename and its value.
I don't want to deal with a .xml file.  Timing in this application does not permit the excessive disc I/O that would be required.

In the Xerces download package is a sample - MemParse.  It loads the DTD and XML into a buffer and parses it.  It uses a SAX parser.
The problem is that the only thing that this sample outputs is How Many Elements, Time to perform the parse, Number of white spaces, Number of Characters - not useful information.   I've been single stepping through this code and find no functionality in any of the classes that are used that provide the functionality that I derived in my working DOM parser.  There is no getName( ) function when you find an element or node or child, there is no getValue( ) function.  I don't even see any functionality to find a child or element or root in the MemParse sample.
Can someone who has performed such a buffer parsing operation before (and extracted more than the useless information that the sample demonstrates) please share the methodology used to accomplish this.  

My DOM parser obviously reads the .xml file and puts it into a buffer.  Then IT parses what is in that buffer.  Why can't I bypass the file read and jump in to where the buffer is already loaded.

I have tried converting buffered file data to the XMLCh type and passed it to the parser only to throw parser exceptions.

Ed Purdy
"Minds are like parachutes, they only work when they're open"


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: XML buffer parser help

Posted by Alberto Massari <am...@progress.com>.
If you find DOMPrint or DOMCount better suited to your job, just create a 
MemBufInputSource around your string and give it to the "parse" method of 
XercesDOMParser.

Alberto

At 09.11 14/01/2004 -0500, Purdy, Edgar M wrote:
>I need to parse a buffer.
>
>I have a working Xerces DOM parser in c++ that parses an XML document.
>I have to migrate that parser to work with a buffer only. I have to pull 
>value pairs out of the XML.  The nodename and its value.
>I don't want to deal with a .xml file.  Timing in this application does 
>not permit the excessive disc I/O that would be required.
>
>In the Xerces download package is a sample - MemParse.  It loads the DTD 
>and XML into a buffer and parses it.  It uses a SAX parser.
>The problem is that the only thing that this sample outputs is How Many 
>Elements, Time to perform the parse, Number of white spaces, Number of 
>Characters - not useful information.   I've been single stepping through 
>this code and find no functionality in any of the classes that are used 
>that provide the functionality that I derived in my working DOM 
>parser.  There is no getName( ) function when you find an element or node 
>or child, there is no getValue( ) function.  I don't even see any 
>functionality to find a child or element or root in the MemParse sample.
>Can someone who has performed such a buffer parsing operation before (and 
>extracted more than the useless information that the sample demonstrates) 
>please share the methodology used to accomplish this.
>
>My DOM parser obviously reads the .xml file and puts it into a 
>buffer.  Then IT parses what is in that buffer.  Why can't I bypass the 
>file read and jump in to where the buffer is already loaded.
>
>I have tried converting buffered file data to the XMLCh type and passed it 
>to the parser only to throw parser exceptions.
>
>Ed Purdy
>"Minds are like parachutes, they only work when they're open"
>
>
>---------------------------------------------------------------------
>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