> I've looked at MemParse and it gives you general information, > but I want the actual node information and data. I have a > parser that parses a file, but now I need to parse a buffer, > i.e. a char*.
I use a stream& input source for C++, but it should generalize. -- Scott class StreamInputSource : public InputSource { public: StreamInputSource(std::istream& is, const char* systemId=NULL) : InputSource(systemId), m_is(is) {} virtual BinInputStream* makeStream() const { return new StreamBinInputStream(m_is); } private: std::istream& m_is; class StreamBinInputStream : public BinInputStream { public: StreamBinInputStream(std::istream& is) : m_is(is), m_pos(0) {} virtual unsigned int curPos() const { return m_pos; } virtual unsigned int readBytes(XMLByte* const toFill, const unsigned int maxToRead); private: std::istream& m_is; unsigned int m_pos; }; }; unsigned int StreamInputSource::StreamBinInputStream::readBytes(XMLByte* const toFill, const unsigned int maxToRead) { XMLByte* target=toFill; unsigned int bytes_read=0,request=maxToRead; // Fulfill the rest by reading from the stream. if (request) { try { m_is.read(reinterpret_cast<char* const>(target),request); m_pos+=m_is.gcount(); bytes_read+=m_is.gcount(); } catch(...) { cerr << "StreamInputSource::StreamBinInputStream::readBytes caught an exception" << endl; *toFill=0; return 0; } } return bytes_read; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]