Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QXmlStreamReader choking on "=" in attribute when attribute has "&" instead of "&amp;"
Billhead last edited by
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 & then it works fine.
Is there any workaround for this or would I need to manually change all of the & to & before I process the file?
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 "& ;"