[xsd-users] reading directly from memory buffer instead of file or URL

Boris Kolpackov boris at codesynthesis.com
Mon Mar 2 08:08:05 EST 2009


Hi Jason,

Jason Lee <Jason.Lee at syniverse.com> writes:

> By reading the header file hello.hxx I realise the constructor only
> takes in 4 types of input:
> 
> 1. std::string (a URI or a local file)
> 
> 2. std::istream
> 
> 3. xercesc::InputSource
> 
> 4. xercesc::DOMDocument
> 
> Is it possible to read and parse a xml source directly from a memory
> buffer instead of from a local file or a URL?

Yes, you can use std::istringstream (<sstream> header) if you buffer
is a simple string or you can use Xerces-C++ MemBufferInputSource for
any kind of memory buffer. The 'performance' example shows how to use
the latter (see the parsing.cxx file).

Boris




More information about the xsd-users mailing list