Re: [xml] Finding a specific element and its text value in an XML message

On Fri, Aug 04, 2006 at 05:09:14PM -0500, Nidal Zeidat wrote:
I have a question. I am a first time libxml2 user. I am looking into
using libxml2 to interpret incoming XML messages (whose XSD files I
have) that I receive in a buffer from a server using TCP/IP connection.
I noticed that libxml2 offers API that could help look for a certain
element (by seraching for an xmlNode with xmlTextReaderNodeType() = 1),
get and check its name (using xmlTextReaderConstName()) and if it is the
right name (element I am looking for) get itx text value (by seraching
for an xmlNode with xmlTextReaderNodeType() = 3). 

instead of their hardcoded values, see xmlReaderTypes in xmlreader.h for
the full list.

Is this the right way to parse an XML message and get the text values
embedded in the message.?

  If there were only one right way, libxml2 would have only one API.
If it does the job for you then it's the right way for you, I don't know
how to be more precise w.r.t. your query.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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