xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Lilley <jlil...@datalever.com>
Subject RE: Reading portions of XML file.
Date Thu, 08 Oct 2009 13:23:14 GMT
You can subclass InputSource and InputStream, then implement it however you like.  In this
snippet, XN:: is defined as the Xerces namespace.

class MyFileInputStream : public XN::BinInputStream {
	MyFileInputStream(...) {}
	virtual XMLFilePos curPos() const { return ... }
	virtual XMLSize_t readBytes(XMLByte* const toFill, const XMLSize_t maxToRead) {
		return ...;
	// No "out-of-band" content type
	virtual const XMLCh* getContentType() const { return 0; }
class DL_GLOBAL_CLASS SaxFileInputSource : public XN::InputSource
public :
	MyFileInputSource(...) {}
	virtual XN::BinInputStream* makeStream() const {
		// Caller is owner of stream
		return new MyFileInputStream(...);


-----Original Message-----
From: Galande, Manish [mailto:Manish_Galande@bmc.com] 
Sent: Thursday, October 08, 2009 7:12 AM
To: c-users@xerces.apache.org
Subject: Reading portions of XML file.


I want to read the portions of XML file depending on byte-position, using getSrcOffset().
Is there a way I can directly start reading/parsing from a pre-defined offset in the source,
similar to lseek and read?



View raw message