Important: Please read the Qt Code of Conduct -

How to get CDATA section with QtXML and QDomDocument related classes?

  • Hello,

    Consider the following code:

    QDomElement updateExtendedDescriptionElement = rootElement.firstChildElement("extendeddescription");

    QDomCDATASection cdataDescriptionElement = updateExtendedDescriptionElement.firchChildElement();

    Now this doesn't compile but I need the equivalent that does, based on the xml I am pullng the updateExtendedDescriptionElement contains a CDATA child node.

    How do I get access to it?

    Thank you.

  • Moderators

    it's not a element, but rather a node, so you can get it via the QDomNode API:

    • QDomNode::isCDATASection()
    • QDomNode::toCDATASection()

  • OK, cool. I will try this.

    Thank you.

Log in to reply