[Qt-interest] QDomNode and namespaces?

B.W.H. van Beest bwvb at xs4all.nl
Tue Jun 1 23:34:12 CEST 2010


Hi,

I have a problem in understanding QDOMElement.
Suppose I have the following XML file:

===========================================================
<?xml version="1.0"?>
<note xmlns="http://www.w3schools.com"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3schools.com note.xsd">
  <to>Tove</to>
  <body>Don't forget me this weekend!</body>
</note>
============================================================

If I focus on the node <note>:   it looks as if there are three
attributes, xmlns="...", xmlns:xsi="..." and xsi:schemaLocation="...".
Apparantly, only the latter is a true attribute.

- the namespace, here  "http://www.w3schools.com", can be obtained by
QDomNode::namespaceURI()
- the function QDomNode::attributes() gives only 1 attribute:
xsi:schemaLocation="http://www.w3schools.com note.xsd"

My question is: how do I obtain the 'attribute'  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
There seems to be no access function for that. What am I overlooking here?

Thanks for helping me understanding.



More information about the Qt-interest-old mailing list