Re: [xml] Finding a specific element and its text value in an XML message
- From: Daniel Veillard <veillard redhat com>
- To: Nidal Zeidat <nzeidat commandsystems com>
- Cc: xml gnome org
- Subject: Re: [xml] Finding a specific element and its text value in an XML message
- Date: Sat, 5 Aug 2006 05:14:15 -0400
On Fri, Aug 04, 2006 at 05:09:14PM -0500, Nidal Zeidat wrote:
Hello
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).
you should use XML_READER_TYPE_ELEMENT, XML_READER_TYPE_TEXT, etc...
instead of their hardcoded values, see xmlReaderTypes in xmlreader.h for
the full list.
Question:
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
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]