Thanks Ozgur. I have attempted to do the following:
static const char* someXML = "<?xml version="\1.0\" encoding=\"ascii\" ?><message>Hello World</message>"; XMLCh* testData = XMLString::transcode(someXML); XMLByte* pXMLByte = reinterpret_cast<XMLByte*>(testData); MemBufInputSource* memIS = new MemBufInputSource(pXMLByte, strlen(someXML), "test", false); mParser->parse((const DOMInputSource&)memIS); --- //mParser is created as: mParser = ((DOMImplementationLS&)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); Using this code, I receive a segmentation fault in ReaderMgr where it attempts to call src.makeStream(). Do I need to prepare my memIS object some other way so that it will properly provide a BinInputStream object to the functions farther down the line? Thanks, Dan On Mon, May 12, 2008 at 12:48 PM, Sahoglu, Ozgur <[EMAIL PROTECTED]> wrote: > > Hi Dan, > > Parsing a file is no different than parsing a memory buffer (or any > other input source). They all use BinInputStream internally if you look > at the Xerces-C++ implementation. All you need to do is create the > MemBufInputSource and pass it to parser's parse() method (see the API > doc > http://xerces.apache.org/xerces-c/apiDocs/classAbstractDOMParser.html#b6 > fbd6cdf84cce77db1c780017d107dd<http://xerces.apache.org/xerces-c/apiDocs/classAbstractDOMParser.html#b6fbd6cdf84cce77db1c780017d107dd> > ). > > DOM parser's parse() method is overloaded to accept a system id (a file > path or URL) or an InputSource, which can be a LocalFileInputSource, a > URLInputSource, a StdInInputSource, a Wrapper4DOMInputSource, or a > MemBufInputSource (see > http://xerces.apache.org/xerces-c/apiDocs/classInputSource.html). > > Cheers, > > > -Ozgur Sahoglu > > -----Original Message----- > From: Dan Arcari [mailto:[EMAIL PROTECTED] > Sent: Monday, May 12, 2008 11:05 AM > To: [email protected] > Subject: Using MemBufInputSource with DOM parser > > Hello, > > We have a library written on top of Xerces-c which uses DOM parsing of > file-based XML. We would like to be able to send a MemBufInputSource (or > derivation) via our library to xerces so we can parse XML which does not > reside in a file. Is this possible, and could anyone share some examples > or > advice on how to go about this? > > Thanks >
