<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Topics tagged with parsing]]></title><description><![CDATA[A list of topics that have been tagged with parsing]]></description><link>https://forum.qt.io/tags/parsing</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 08:55:53 GMT</lastBuildDate><atom:link href="https://forum.qt.io/tags/parsing.rss" rel="self" type="application/rss+xml"/><pubDate>Invalid Date</pubDate><ttl>60</ttl><item><title><![CDATA[Cannot read XSD attribute with QXMLStreamReader]]></title><description><![CDATA[I'm sorry but you must be moving the cursor in some way. Try putting Q_ASSERT(m_node.isStartElement()); just before auto x = m_node.attributes().size();
This example parses the XSD you provided correctly (I also let QXmlStreamReader handle namespaces instead of having to write custom code for it):
int main()
{
    const QString xmlText(R"***(&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
      &lt;xs:element name = "elementName"&gt;
        &lt;xs:simpleType&gt;
          &lt;xs:restriction base = "xs:string"&gt;
          &lt;/xs:restriction&gt;
        &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:schema&gt;)***"
    );
    QXmlStreamReader reader(xmlText);
    while (!reader.atEnd()) {
        switch(reader.readNext()){
        case QXmlStreamReader::StartDocument:
            qDebug("Start of document");
            break;
        case QXmlStreamReader::EndDocument:
            qDebug("End of document");
            break;
        case QXmlStreamReader::StartElement:{
            qDebug() &lt;&lt; "Started Element: " &lt;&lt; reader.name();
            const auto attr = reader.attributes();
            qDebug() &lt;&lt; "Number of Attributes: " &lt;&lt; attr.size() &lt;&lt; " Attributes:";
            for(auto&amp;&amp; att : attr)
                qDebug() &lt;&lt; att.name() &lt;&lt; " = " &lt;&lt; att.value();
        }
            break;
        case QXmlStreamReader::EndElement:
            qDebug() &lt;&lt; "Finished Element: " &lt;&lt; reader.name();
            break;
        default:
            break;
        }
    }
    return 0;
}

]]></description><link>https://forum.qt.io/topic/114949/cannot-read-xsd-attribute-with-qxmlstreamreader</link><guid isPermaLink="true">https://forum.qt.io/topic/114949/cannot-read-xsd-attribute-with-qxmlstreamreader</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[how to use &#x2F;Qt&#x2F;5.8&#x2F;Src&#x2F;qtdeclarative&#x2F;src&#x2F;qml&#x2F;parser ?]]></title><description><![CDATA[Hi,
You will have to use the corresponding private module in your project.
]]></description><link>https://forum.qt.io/topic/113050/how-to-use-qt-5-8-src-qtdeclarative-src-qml-parser</link><guid isPermaLink="true">https://forum.qt.io/topic/113050/how-to-use-qt-5-8-src-qtdeclarative-src-qml-parser</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Runtime notification regarding stylesheet]]></title><description><![CDATA[@qt_emp
Hi
Yes it will work.
https://doc.qt.io/archives/qt-4.8/qtglobal.html#qInstallMsgHandler
(name is slightly different. works the same as far as i know)
]]></description><link>https://forum.qt.io/topic/107095/runtime-notification-regarding-stylesheet</link><guid isPermaLink="true">https://forum.qt.io/topic/107095/runtime-notification-regarding-stylesheet</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[C++ file parser and function extractor]]></title><description><![CDATA[@alizadeh91
I don't have a solution for you, only a warning.  If you intend to parse arbitrary C++ files from anywhere, rather than some terribly cut-down subset whose layout you know intimately, you're going to find this very hard to do.  Very, very hard!
Heck, you can't even write a grammar for parsing C++ source files because of the pre-processor, e.g. http://trevorjim.com/c-and-cplusplus-are-not-context-free/


To parse C and C++, you start by using a very powerful preprocessor. These preprocessors are inevitably written by hand (they are not based on a theoretic foundation like regular expressions or context-free grammars).


As far as I am aware, there is no open source which will produce a standalone parse tree for you.  The consensus (search the web) is that you really need to try to leverage an existing C++ compiler to do such a job.  You could look at gcc, or perhaps more likely clang.  I still don't think you'll get what you want out of them.
If all you want to do is some hacky approximation which just extracts #include statements so that you can follow them then you could do something with QRegularExpressions.  Correctly locating &amp; extracting the definition of functions in .cpp/.h files will be harder --- you'll probably end up making all sorts of assumptions as to where definitions start &amp; end more on a line-by-line basis than via regular expressions or proper parsing.  It may do you for your purposes, provided you are happy with some vague approximation which is not robust.
Sorry, but good luck!
]]></description><link>https://forum.qt.io/topic/104936/c-file-parser-and-function-extractor</link><guid isPermaLink="true">https://forum.qt.io/topic/104936/c-file-parser-and-function-extractor</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[parse command line args in form &#x2F;variable=value ?]]></title><description><![CDATA[very helpful. Thank you!
]]></description><link>https://forum.qt.io/topic/91197/parse-command-line-args-in-form-variable-value</link><guid isPermaLink="true">https://forum.qt.io/topic/91197/parse-command-line-args-in-form-variable-value</guid><dc:creator><![CDATA[pmh4514]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Parsing JSON in QML]]></title><description><![CDATA[@Wieland: Thanks!
]]></description><link>https://forum.qt.io/topic/75563/parsing-json-in-qml</link><guid isPermaLink="true">https://forum.qt.io/topic/75563/parsing-json-in-qml</guid><dc:creator><![CDATA[Stefan Monov76]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Parse HTML in Qt 5.7]]></title><description><![CDATA[@Joel-Bodenmann So I can just use "runJavaScript" function ?!
@SGaist No, that was just an example !! :D
]]></description><link>https://forum.qt.io/topic/68623/parse-html-in-qt-5-7</link><guid isPermaLink="true">https://forum.qt.io/topic/68623/parse-html-in-qt-5-7</guid><dc:creator><![CDATA[AliReza Beytari]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Qt Quick Designer - JS binding]]></title><description><![CDATA[I have found a workaround but I am still open with a better idea..
I have modify this source file of qt creator "src/plugins/qmldesigner/qmldesignerextension/connectioneditor/bindingmodel.cpp"
I added the field "Global" in "Source Item" and when Global is selected in souce item I read my js file and with a regexp I add variables in "Source Property"
]]></description><link>https://forum.qt.io/topic/64961/qt-quick-designer-js-binding</link><guid isPermaLink="true">https://forum.qt.io/topic/64961/qt-quick-designer-js-binding</guid><dc:creator><![CDATA[Okyn]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[How to get the inner xml from a node using QXmlStreamReader?]]></title><description><![CDATA[<p dir="auto">Hi, I'm trying to efficiently parsing a large xml file. The parser shall be split in a generic part which parses the main structure of the xml-file (first and second level nodes) and in different custom parts which continue parsing details from 3rd level nodes.</p>
<p dir="auto">The whole node at level 3 should be given to a custom parser (as QString).</p>
<p dir="auto">My approach was to use the QXmlStreamReader because the documentation sais that this is the fastest and most efficient way to parse an xml-file without loading the whole content in memory.<br />
Unfortunately i didn't find a function that allows to collect the inner text of a node.<br />
I don't want to pass the reference of the StreamReader to the the custom parsers because they may read too much if they are buggy. The outer/generic parser at level 1 and 2 should be able to control the content given to the custom parsers.</p>
<p dir="auto">I'd be glad if somebody could help me with this issue. Maybe i am on the wrong way...</p>
<p dir="auto">Here a sample xml which should be parsed:</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;!DOCTYPE LogData&gt;<br />
&lt;LogData&gt;<br />
&lt;LogEntry&gt;		<br />
&lt;ReadData&gt;		<br />
&lt;Timestamp year="2015" month="11 day="13" time="12:19:22.037"/&gt;<br />
&lt;Address&gt;0x22&lt;/Address&gt;<br />
&lt;Value&gt;0x42&lt;/Value&gt;<br />
&lt;/ReadData&gt;<br />
&lt;/LogEntry&gt;<br />
&lt;LogEntry&gt;<br />
&lt;ReadData&gt;<br />
&lt;Timestamp year="2015" month="11 day="13" time="12:19:22.192"/&gt;<br />
&lt;Address&gt;0x23&lt;/Address&gt;<br />
&lt;Value&gt;0x55&lt;/Value&gt;<br />
&lt;/ReadData&gt;<br />
&lt;/LogEntry&gt;<br />
&lt;LogEntry&gt;<br />
&lt;WriteData&gt;<br />
&lt;Timestamp year="2015" month="11 day="13" time="12:19:23.744"/&gt;<br />
&lt;Address&gt;0x20&lt;/Address&gt;<br />
&lt;Value&gt;0x13&lt;/Value&gt;<br />
&lt;Mask&gt;0x3F&lt;/Mask&gt;<br />
&lt;Policy&gt;0&lt;/Policy&gt;<br />
&lt;/WriteData&gt;<br />
&lt;/LogEntry&gt;<br />
&lt;LogEntry&gt;<br />
&lt;WriteData&gt;<br />
&lt;Timestamp year="2015" month="11 day="13" time="12:19:23.835"/&gt;<br />
&lt;Address&gt;0x21&lt;/Address&gt;<br />
&lt;Value&gt;0x02&lt;/Value&gt;<br />
&lt;Mask&gt;0x3F&lt;/Mask&gt;<br />
&lt;Policy&gt;1&lt;/Policy&gt;<br />
&lt;/WriteData&gt;<br />
&lt;/LogEntry&gt;<br />
&lt;LogEntry&gt;<br />
&lt;SetConfig&gt;<br />
&lt;Classes&gt;<br />
&lt;Class Name="Msc::Trigger"/&gt;<br />
&lt;Class Name="Msc::Logger"/&gt;<br />
&lt;Class Name="Msc::Parser"/&gt;<br />
&lt;/Classes&gt;<br />
&lt;/SetConfig&gt;<br />
&lt;/LogEntry&gt;<br />
&lt;/LogData&gt;</p>
<p dir="auto">The generic parser should only parse &lt;LogData&gt; and &lt;LogEntry&gt; tags. Everything which is within ONE &lt;LogEntry&gt; should be given to a custom parser depending on the inner tags name. But QXmlStreamReader does not seem to provide a function which gives the inner xml of a node :-/</p>
<p dir="auto">Thanks a lot for answers.</p>
<p dir="auto">BR</p>
]]></description><link>https://forum.qt.io/topic/60632/how-to-get-the-inner-xml-from-a-node-using-qxmlstreamreader</link><guid isPermaLink="true">https://forum.qt.io/topic/60632/how-to-get-the-inner-xml-from-a-node-using-qxmlstreamreader</guid><dc:creator><![CDATA[ams_bob]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Parsing Cascading Style Sheet like file]]></title><description><![CDATA[@Ralf
Oh,  :(
Well in that case I would download source code for whole Qt
and have a look of what they use for
the qss (css) parsing and see if some could be reused. ( i have no idea)
Also
http://www.codeproject.com/Articles/20450/Simple-CSS-Parser
is a good read (IMO) for toughs about writing such parser.
Good luck
]]></description><link>https://forum.qt.io/topic/56788/parsing-cascading-style-sheet-like-file</link><guid isPermaLink="true">https://forum.qt.io/topic/56788/parsing-cascading-style-sheet-like-file</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>