Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. GetElementsByTagName("") - is not supported by XmlHttpRequest??

GetElementsByTagName("") - is not supported by XmlHttpRequest??

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 4.4k 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.
  • C Offline
    C Offline
    cmer4
    wrote on 22 Aug 2011, 15:55 last edited by
    #1

    Hello gents and ladies...
    So seems like XmlHttpRequest is gimped in QML and I can't use getElementsByTagName command to parse it?:(

    Is there other way around apart from the one I was using (by browsing through the Dom tree...:

    @
    doc.responseXML.documentElement.childNodes[1].childNodes[3].childNodes[1].childNodes[1].childNodes[1].childNodes[7].childNodes[1].childNodes[5].childNodes[1].childNodes[0].nodeValue
    @

    I would love to use:

    @
    doc.responseXML.documentElement.getElementsByTagName('thetag')
    @

    [EDIT: code formatting, please use @-tags, Volker]

    What is the workaround then?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      herophuong
      wrote on 23 Jul 2012, 06:53 last edited by
      #2

      This is already a bug: https://bugreports.qt-project.org/browse/QTBUG-19809

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ices_Eyes
        wrote on 23 Jul 2012, 09:48 last edited by
        #3

        You can implement your own getElementByTag name, something like:
        @function getElementsByTagName(rootElement, tagName) {
        var childNodes = rootElement.childNodes;
        var elements = [];
        for(var i = 0; i < childNodes.length; i++) {
        if(childNodes[i].nodeName === tagName) {
        elements.push(childNodes[i]);
        }
        }
        return elements;
        }@

        :)

        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