Re: [xml] Attributes without knowing name



On Fri, Feb 01, 2002 at 01:18:50PM +0100, Rygg Christian Ingemann wrote:
I'm working on an XML cryptographic signer, both in Java and in C++. The
Java version (Using Xerces) is finished, but I have now hit a problem in the
C++ version (Using libxml).

When signing, the string that is signed must be identical to the one which
is checked at some later time. The problem with this and XML is that
attribute order isn't important, and libxml and Xerces orders them
diffrently, so I need to sort them. The signer must be general, so it
shouldn't need to know the names of the attributes in the given element. So,
I need to get all the attributes from an element without knowing the names
of these attributes. I was looking at the documentation, for something like:

xmlGetPropCount(xmlNodePtr node);

and

xmlGetProp(xmlNodePtr node, int index);

... but I couldn't find anything like this, or anything that could do the
job. Is what I'm attempting possible, and if so, how?

  It's not accessible directly as a function, but directly from the
xmlNodePtr structure (which is not opaque),
    node->properties
   containst the first xmlAttrPtr (or NULL)
    node->properties->next
   containst the second xmlAttrPtr (or NULL)
 etc ...
  the xmlAttrPtr list is a doubly chained list, reordering the elements
should not be a proble if you need to, just make sure all pointers
(node->properties , ->next and ->prev for the attributes) are coherent.

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]