Reputation: 67
I need to read data from my own stream and parse it using Xerces/C++ (SAX or SAX2) as it arrives. I've seen Xerces Java FAQ on this, but Java and C++ APIs don't really seem to match; at least, I can't see a DefaultReaderFactory class in C++ API. So, is non-buffered reading from a stream supported in C++ API? If yes, I would be grateful for a code example or an advice on how to port the Java approach to C++.
Upvotes: 1
Views: 963
Reputation: 13288
You should take a look at http://xerces.apache.org/xerces-c/program-sax2-2.html
Basically you can create an instance of SAX2XMLReader then you can use one of its 3 parse
member functions to parse from the stream source you are using. Using MemBufInputSource is probably the way that suits most situations.
Upvotes: 0
Reputation: 249153
I think you want to use SAXParser::parseFirst(InputSource, token)
and parseNext(token)
, either MemBufInputSource if you have the data laying in memory somewhere and can point to it, or by implementing your own InputSource.
Upvotes: 2