Re: [xml] getting values of attributes
- From: Daniel Veillard <veillard redhat com>
- To: Krishnan narayanan iflexsolutions com
- Cc: xml gnome org
- Subject: Re: [xml] getting values of attributes
- Date: Mon, 2 Sep 2002 02:13:56 -0400
On Mon, Sep 02, 2002 at 11:01:13AM +0530, Krishnan narayanan iflexsolutions com wrote:
Hi
We are currently using a program, which will parse an XML documents contents
and store the values into a database. I have a small doubt here. The method,
which is being currently used works in this way: the node pointer moves to
each element and then we do a "string compare" of the element's name (since
we know the names of the elements through the DTD). If the status comes
true, then we use xmlGetProp to get the value present in every attribute of
the element. But here, for every attribute, we are using an xmlGetProp and
this process becomes cumbersome if the number of attributes are more for any
element and if the XML file is large.
I will try to give an example pertaining to this. Suppose I have an element
by name SHIRT and it has a number of attributes like COLOR, TEXTURE and SIZE
etc the program "string compares" the string SHIRT with the name of the
element to which the node is pointing to. When this is true, it uses
xmlGetProp repetitively for every attribute (for COLOR, for TEXTURE, for
SIZE) to get the attribute values.
I would like to know if there is any method by which I can retrieve an
attribute's value without having do go through such a process. It would be
great if you could help me out. I have been desperately trying to find out a
method but haven't been successful.
Read the code of xmlGetProp and do the lookup directly from the internal
structure in a similar way. I don't what else you could do.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.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]