[Expat-discuss] How to extract untranslated XML from a stream

James Whetstone jameswhetstone at comcast.net
Sat Nov 11 19:10:00 CET 2006


Hi,

I'm working on a project where, in addition to parsing all the elements in 
an XML stream, I need to obtain all the unparsed XML content between 2 tags. 
Here's an example:

<envelope>
    <packet>
        <tag_one>data</tag_one>
        <tag_two>
            <tag_three>more data</tag_three>
        </tag_two>
    </packet>
</envelope>

So with this example, I want to extract all the XML content between the 
<envelope> tags and then parse the stream using standard handlers.  Can 
anyone make some suggestion here or point me in the right direction?  Is 
this even possible with the API?  From what I can tell, it isn't really 
designed to extract untranslated XML bytes like this.

The reason I want to do this is because I want to parse the stream and save 
the data to a database in two ways:  I want to save the data as individual 
columns AND as an entire XML document for quick retrieval.  Ideally, I'd 
like to store the XML document without having to re-copy the content to a 
separate buffer.


Thanks,
James



More information about the Expat-discuss mailing list