Reputation: 2969
I got some sensible xml data I'd like to parse with Xerces (generated by CodeSynthesis).
On disc it is crypted so I load it, uncrypt it and ... I'm stuck as Xerces only takes files as input.
I have thought about overloading one of the 'readers' (ie. std::istream or xercesc::InputSource) and fake the disc reading but it seems as quirky as inelegant.
Are there any simpler and neater way to do this?
Thanks!
Upvotes: 0
Views: 2120
Reputation: 9573
You can use the MemBufInputSource
class:
MemBufInputSource* pMemBufIS = new MemBufInputSource((const XMLByte*)sXmlContent.c_str(), sXmlContent.length(), "SysID", false);
m_saxParser.parse(*pMemBufIS);
delete pMemBufIS;
instead of
m_saxParser.parse(sXmlFilePath.c_str());
Upvotes: 5