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. QXmlStreamReader choking on "=" in attribute when attribute has "&" instead of "&"
Forum Updated to NodeBB v4.3 + New Features

QXmlStreamReader choking on "=" in attribute when attribute has "&" instead of "&"

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k 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.
  • B Offline
    B Offline
    Billhead
    wrote on last edited by
    #1

    Hello,
    Sorry if I'm posting this in the wrong place but I don't know if it's a bug or intended behavior.
    I'm trying to make a screen scraper to pull info from a website using QXmlStreamReader but I'm running into a problem when an HTML tag looks something like this: <script src="example.php?parm1=test&parm2=test" />
    It gives me the error "Expected ';', but got '='." but if I change the & to &amp; then it works fine.

    Is there any workaround for this or would I need to manually change all of the & to &amp before I process the file?

    Thanks

    1 Reply Last reply
    0
    • JKSHJ Online
      JKSHJ Online
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      That's expected behaviour.

      Your tag is not valid XML; you'll get the same error if you put it through an external XML validator (e.g. http://www.w3schools.com/xml/xml_validator.asp )

      You must encode all strings in XML -- that includes converting all "&" to "&amp ;"

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      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