[xml] getting values of attributes

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.
Thanx in advance

K Narayanan
Iflex Solutions Ltd. Chennai
Ph: 8234321 Extn: 4627

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