QXmlStreamReader and empty namespaceUri() on attributes

sdrakulich

New Member
This is as much an XML question as it is a Qt one: Why does the following test for a namespace-uri of the \[code\]attr\[/code\] attribute of the \[code\]foo\[/code\] element fail?\[code\]{ const QString test("<foo xmlns='http://example.org/ns' attr='value'><empty/></foo>"); QXmlStreamReader r(test); QVERIFY(r.namespaceProcessing()); QVERIFY(r.readNextStartElement()); QCOMPARE(r.name().toString(), QLatin1String("foo")); QCOMPARE(r.namespaceUri().toString(), QLatin1String("http://example.org/ns")); QVERIFY(!r.attributes().isEmpty()); QCOMPARE(r.attributes().front().name().toString(), QLatin1String("attr")); // FAIL, namespaceUri() is empty: QCOMPARE(r.attributes().front().namespaceUri().toString(), QLatin1String("http://example.org/ns"));}\[/code\]Is this a \[code\]QXmlStreamReader\[/code\] bug, or are XML attributes in general not in the namespace declared with \[code\]xmlns\[/code\]?
 
Back
Top