Looking at what goes in to setting up MemBufInputSource there are a number of command line inputs that must be considered. Since my application will not be a stand alone executable but a function within a larger application, I suppose that I can hard code the settings that would otherwise be read from the command line???
What command line inputs are you referring to? You just need to call
char * myXMLString="blah blah"; MemBufInputSource* memBufIS = new MemBufInputSource ( (const XMLByte*)myXMLString , strlen(myXMLString) , "dummy" , false ); parser->parse(memBufIS);
You need to set some options on the parser, but you were already setting those up when loading from a file.
A second question --
Is there Xerces functionality that will generate a standardized XML document from some input source, or must discreet code be written to generate standard XML.
It depends on what you define "some input source"; if it is a binary stream, a CVS file or an EDI packet, you will have to write code to map that data into an XML structure.
If you mean taking a well-formed XML document and fix namespaces, merge adjacent DOMText nodes, etc. you can call DOMDocument::normalizeDocument
If you mean taking a well-formed XML document and make it "canonical", you could use a DOMWriter object with the "canonical-form" attribute set, if it were implemented.
Alberto
-----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 14, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: Re: XML buffer parser help
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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]