Hi, Good day. I want to get the attributes of an xml using libxml2 and save it to a stl map in c++? Can someone help me? tnx.

Recommended Answers

All 2 Replies

There's quite a bit of useful sample code at xmlsoft.org, and for your specific needs, the xmlNode struct contains field:

struct _xmlAttr * properties; // properties list

which I believe will prove useful to you in extracting the attributes.

As far as saving it into a map, that should be straightforward. Assuming you will have a possibly-empty map for each XML element, then you should be able to extract the attribute-name and attribute-value for each attribute and use the name as the key into the map.

tnx for the reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.