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. XPath query of DOM.
QtWS25 Last Chance

XPath query of DOM.

Scheduled Pinned Locked Moved General and Desktop
7 Posts 5 Posters 8.8k 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.
  • M Offline
    M Offline
    Matt
    wrote on last edited by
    #1

    Are there any plans to support XPath querying of QDomDocument?

    I believe it would be useful if it was possible to query a (or part of a) QDomDocument and get a QDomElementList. This could make querying a parsed QDomDocument much easer and may allow us to more easily edit the XML based upon XPath results.

    (This has been mentioned before at "http://labs.trolltech.com/forums/topic/167":http://labs.trolltech.com/forums/topic/167 .)

    Can anyone suggest an easy way to change the XML based on an XPath (specifically I want to remove elements that match an XPath)?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Don't count on it. I understand from comments by Thiago on the mailinglist, that the DOM classes are considdered EOL. Grave bugs are fixed, but other than that, they don't get much attention.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        david.boddie
        wrote on last edited by
        #3

        I think it's interesting to look at using XQuery for general XML handling. I started to explore this in my last Qt Quarterly article, "Checking the Weather with XQuery":http://qt.nokia.com/developer/qtquarterly/checking-the-weather-with-xquery, and I'll be writing a follow-up article that looks at visualizing queries for the next issue of QQ (due later this month).

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Matt
          wrote on last edited by
          #4

          Excellent article David, I look forward to reading the next issue.
          I have managed to achieve what I wanted using an "XSLT identity transform":http://en.wikipedia.org/wiki/Identity_transform#Example_using_XSLT.

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

            http://doc.trolltech.com/4.5/qxmlquery.html#running-xpath-expressions

            wouldn't it just be possible to fetch these nodes using xPath and then remove them?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              texas
              wrote on last edited by
              #6

              One possible way, not saying it's good, is to have all your QDomElements in the DOM be hashed with an xmlid. Then you can use a QXmlSerializer receiver and query for the xmlid's of the elements you want. Then you can get your list of elements via the id hash.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                Don't wake the dead, please. The last post here was from August 2010, almost one and a half year ago...

                http://www.catb.org/~esr/faqs/smart-questions.html

                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