[xml] Copying contents from UTF-8 buffer...



Hi,

I am using libxml’s SAX2 set of API’s for parsing xml files…

 

Now, based on the requirements, for some of the elements I don’t bother about the content…instead want to store whatever is present as text (UTF-8 encoded)…

 

For ex:

<a>

  <b> this is a test </b>

  <jellyfish/>

</a>

 

Here ..when I parse this..i want to store the content of element ‘a’..as it is present in the file/buffer..(also the file can be encoded in any of the iconv supported encoding format..)

 

Now, the problem is… I initially thought that I can copy the content from the buffer (UTF-8 encoded), for which the reference is stored in the xmlParserInput structure in the parser context..

 

Like..i can store the ‘cur’ pointer when I get startElement event for element ‘a’ and the using the ‘cur’ pointer when I get the endElement event for ‘a’ and the one stored I can copy the contents from the buffer…..

 

But now I have discovered that the content changes at times..so there is a possibility that the buffer content is changed

When I want to copy the content from it…

 

Can you give a solution...so that I can use the same buffer pointers ( cur, end etc) to copy the content from the UTF-8 encoded buffer….

 

Or atleast some kind of hook to know that the buffer content is changed...i.e. more content is read from input buffer to the UTF-8 encoded buffer.

 

Thanks in advance…

 

Regards,

Harbhanu

 

***************************************************************************************

            This e-mail and attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient's) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]