How to get namespaces in the root QDomElement?



  • most xml like to declare namespaces in the root element like this:

    <root xmlns="a" xmlns:x="b">
        <x:e />
    </root>
    

    but call QDomDocument::setContent with setting namespaceProcessing to true will result unexpected behavior:

    rootElem.prefix(); // ""
    rootElem.namespaceURI(); // "a"
    eElem.prefix(); // "x"
    eElem.namespaceURI(); // "b"
    rootElem.attributes(); // empty map!!!  can't even parse manually
    

    Is there an easy way to get all namespaces in a QDomElement?

    thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.