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. Parser Xml with Root empty
Forum Updated to NodeBB v4.3 + New Features

Parser Xml with Root empty

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.4k Views 1 Watching
  • 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
    mr_wallyit
    wrote on 3 Dec 2014, 12:31 last edited by
    #1

    Hello,

    I need to do a parser of a xml file with root empty, but I have this error " Failed to load the document "error occurred while parsing element" line 2 column 2". Is there a solution?
    @
    <?xml version="1.0" standalone="yes"?>
    <>
    <row>
    <scr_code>5</scr_code>
    <area_code>0</area_code>
    <area_type>0</area_type>
    </row>
    </>
    @
    Thanks
    Pier

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 4 Dec 2014, 06:34 last edited by
      #2

      Hi,

      How could that be a valid XML document ?
      AFAIK, XML Documents Must Have a root element. Correct me if I'm wrong. "QDomDocument::setContent":http://qt-project.org/doc/qt-5/qdomdocument.html#setContent should give an error.

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mr_wallyit
        wrote on 22 Dec 2014, 16:06 last edited by
        #3

        Hello,

        sorry for the replay but I was outsite.

        This file with Java is a valid xml, I don't have a error when I do the parser. How I did a workarround before the parser, I changed <> in <root>
        @
        <root> <row> <scr_code>5</scr_code> <area_code>0</area_code> <area_type>0</area_type> </row>
        </root>
        @
        I think that is a bug.

        Thanks

        1 Reply Last reply
        0
        • P Offline
          P Offline
          p3c0
          Moderators
          wrote on 23 Dec 2014, 04:56 last edited by
          #4

          Now above is the valid XML. But I dont see a matching closing tag for <roor>. Is that a typo ?

          157

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mr_wallyit
            wrote on 23 Dec 2014, 07:28 last edited by
            #5

            Sorry, I correct roor in root

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JvdGlind
              wrote on 23 Dec 2014, 13:24 last edited by
              #6

              http://www.w3schools.com/xml/xml_validator.asp

              This shows your original XML is invalid. I don't think it is a bug.

              Jeffrey VAN DE GLIND
              Principle Consultant @ Nalys
              www.nalys-group.com

              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