I'm parsing XML using pugi xml, which is not a namespace-aware parser (see Using Boost to read and write XML files). I'm trying to figure out how much of an issue this might be, but the problem is I don't 100% understand what XML namespaces are used for.
Here is an example of some XML (that I created) that would be problematic:
<Results>
<Documents xmlns:active="...">
<Document>...</Document>
</Documents>
<Documents xmlns:archived="...">
<Document>...</Document>
<Document>...</Document>
<Document>...</Document>
<Document>...</Document>
</Documents>
</Results>
Given an XPath expression like /Results/Documents/Document
, all pugi could do for me is extract all <Document>
elements -- I'd lose the active/archived information. However, I'm not sure if I'd ever encounter this type of namespace use in the real world. It seems like in this situation it would be better use an attribute to get across the active/archived information. Can someone help me better understand the situations namespaces are used in so I can get a better idea for what I'd be losing out on by sticking with pugi xml?