Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get namespaces in the root QDomElement?
Qt 6.11 is out! See what's new in the release blog

How to get namespaces in the root QDomElement?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 444 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kkkiio
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved