1

これは、Qt の問題であると同時に XML の問題でもあります。要素のattr属性の名前空間 uri に対する次のテストがfoo失敗するのはなぜですか?

{
    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"));
}

これはQXmlStreamReaderバグですか、それとも XML 属性は一般に で宣言された名前空間にありませんxmlnsか?

4

1 に答える 1