Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2477

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QXmlSimpleReader" doc="/**
&lt;p&gt;The &lt;a href=&quot;QXmlSimpleReader.html#QXmlSimpleReader()&quot;&gt;&lt;tt&gt;QXmlSimpleReader&lt;/tt&gt;&lt;/a&gt; class provides an implementation of a simple XML parser.&lt;/p&gt;
&lt;p&gt;This XML reader is suitable for a wide range of applications. It is able to parse well-formed XML and can report the namespaces of elements to a content handler; however, it does not parse any external entities. For historical reasons, Attribute Value Normalization and End-of-Line Handling as described in the XML 1.0 specification is not performed.&lt;/p&gt;
&lt;p&gt;The easiest pattern of use for this class is to create a reader instance, define an input source, specify the handlers to be used by the reader, and parse the data.&lt;/p&gt;
&lt;p&gt;For example, we could use a &lt;a href=&quot;%2E%2E/core/QFile.html&quot;&gt;&lt;tt&gt;QFile&lt;/tt&gt;&lt;/a&gt; to supply the input. Here, we create a reader, and define an input source to be used by the reader:&lt;/p&gt;
&lt;pre&gt;        QXmlSimpleReader xmlReader;
        QXmlInputSource *source = new QXmlInputSource(file);&lt;/pre&gt;
&lt;p&gt;A handler lets us perform actions when the reader encounters certain types of content, or if errors in the input are found. The reader must be told which handler to use for each type of event. For many common applications, we can create a custom handler by subclassing &lt;a href=&quot;QXmlDefaultHandler.html&quot;&gt;&lt;tt&gt;QXmlDefaultHandler&lt;/tt&gt;&lt;/a&gt;, and use this to handle both error and content events:&lt;/p&gt;
&lt;pre&gt;        Handler *handler = new Handler;
        xmlReader.setContentHandler(handler);
        xmlReader.setErrorHandler(handler);&lt;/pre&gt;
&lt;p&gt;If you don't set at least the content and error handlers, the parser will fall back on its default behavior---and will do nothing.&lt;/p&gt;
&lt;p&gt;The most convenient way to handle the input is to read it in a single pass using the &lt;a href=&quot;QXmlSimpleReader.html#parse(com.trolltech.qt.xml.QXmlInputSource)&quot;&gt;&lt;tt&gt;parse&lt;/tt&gt;&lt;/a&gt; function with an argument that specifies the input source:&lt;/p&gt;
&lt;pre&gt;        bool ok = xmlReader.parse(source);

        if (!ok)
            std::cout &amp;lt;&amp;lt; &amp;quot;Parsing failed.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;/pre&gt;
&lt;p&gt;If you can't parse the entire input in one go (for example, it is huge, or is being delivered over a network connection), data can be fed to the parser in pieces. This is achieved by telling &lt;a href=&quot;QXmlSimpleReader.html#parse(com.trolltech.qt.xml.QXmlInputSource)&quot;&gt;&lt;tt&gt;parse&lt;/tt&gt;&lt;/a&gt; to work incrementally, and making subsequent calls to the &lt;a href=&quot;QXmlSimpleReader.html#parseContinue()&quot;&gt;&lt;tt&gt;parseContinue&lt;/tt&gt;&lt;/a&gt; function, until all the data has been processed.&lt;/p&gt;
&lt;p&gt;A common way to perform incremental parsing is to connect the &lt;tt&gt;readyRead()&lt;/tt&gt; signal of the input source to a slot, and handle the incoming data there. For example, the following code shows how a parser for &lt;a href=&quot;http://web.resource.org/rss/1.0/&quot;&gt;RSS feeds&lt;/tt&gt;&lt;/a&gt; can be used to incrementally parse data that it receives from a &lt;a href=&quot;%2E%2E/network/QHttp.html&quot;&gt;&lt;tt&gt;QHttp&lt;/tt&gt;&lt;/a&gt; object:&lt;/p&gt;
&lt;pre&gt;    void RSSListing::readData(const QHttpResponseHeader &amp;amp;resp)
    {
        bool ok;

        if (resp.statusCode() != 200)
            http.abort();
        else {
            xmlInput.setData(http.readAll());

            if (newInformation) {
                ok = xmlReader.parse(&amp;amp;xmlInput, true);
                newInformation = false;
            }
            else
                ok = xmlReader.parseContinue();

            if (!ok)
                http.abort();
        }
    }&lt;/pre&gt;
&lt;p&gt;Aspects of the parsing behavior can be adapted using &lt;a href=&quot;QXmlSimpleReader.html#setFeature(java.lang.String, boolean)&quot;&gt;&lt;tt&gt;setFeature&lt;/tt&gt;&lt;/a&gt; and setProperty(). For example, the following code could be used to enable reporting of namespace prefixes to the content handler:&lt;/p&gt;
&lt;pre&gt;    xmlReader.setFeature(&amp;quot;http:&lt;span class=&quot;comment&quot;&gt;//xml.org/sax/features/namespace-prefixes&amp;quot;, true);&lt;/span&gt;&lt;/pre&gt;
 */">
    <method name="public QXmlSimpleReader()" doc="/**
&lt;p&gt;Constructs a simple XML reader.&lt;/p&gt;
 */"/>
    <method name="public com.trolltech.qt.xml.QXmlDTDHandlerInterface DTDHandler()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setDTDHandler(com.trolltech.qt.xml.QXmlDTDHandlerInterface)&quot;&gt;&lt;tt&gt;setDTDHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.xml.QXmlContentHandlerInterface contentHandler()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setContentHandler(com.trolltech.qt.xml.QXmlContentHandlerInterface)&quot;&gt;&lt;tt&gt;setContentHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.xml.QXmlDeclHandlerInterface declHandler()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setDeclHandler(com.trolltech.qt.xml.QXmlDeclHandlerInterface)&quot;&gt;&lt;tt&gt;setDeclHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.xml.QXmlEntityResolverInterface entityResolver()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setEntityResolver(com.trolltech.qt.xml.QXmlEntityResolverInterface)&quot;&gt;&lt;tt&gt;setEntityResolver&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.xml.QXmlErrorHandlerInterface errorHandler()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setErrorHandler(com.trolltech.qt.xml.QXmlErrorHandlerInterface)&quot;&gt;&lt;tt&gt;setErrorHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean feature(java.lang.String name)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QXmlSimpleReader.html#feature(java.lang.String)&quot;&gt;feature&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;name&lt;/tt&gt;, 0).
@see &lt;a href=&quot;QXmlSimpleReader.html#setFeature(java.lang.String, boolean)&quot;&gt;&lt;tt&gt;setFeature&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean feature(java.lang.String name)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QXmlSimpleReader.html#feature(java.lang.String)&quot;&gt;feature&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;name&lt;/tt&gt;, 0). */"/>
    <method name="public boolean hasFeature(java.lang.String name)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public boolean hasProperty(java.lang.String name)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public com.trolltech.qt.xml.QXmlLexicalHandlerInterface lexicalHandler()" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#setLexicalHandler(com.trolltech.qt.xml.QXmlLexicalHandlerInterface)&quot;&gt;&lt;tt&gt;setLexicalHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean parse(com.trolltech.qt.xml.QXmlInputSource input, boolean incremental)" doc="/**
&lt;p&gt;Reads an XML document from &lt;tt&gt;input&lt;/tt&gt; and parses it. Returns true if the parsing is completed successfully; otherwise returns false, indicating that an error occurred.&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;incremental&lt;/tt&gt; is false, this function will return false if the XML file is not read completely. The parsing cannot be continued in this case.&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;incremental&lt;/tt&gt; is true, the parser does not return false if it reaches the end of the &lt;tt&gt;input&lt;/tt&gt; before reaching the end of the XML file. Instead, it stores the state of the parser so that parsing can be continued later when more data is available. In such a case, you can use the function &lt;a href=&quot;QXmlSimpleReader.html#parseContinue()&quot;&gt;&lt;tt&gt;parseContinue&lt;/tt&gt;&lt;/a&gt; to continue with parsing. This class stores a pointer to the input source &lt;tt&gt;input&lt;/tt&gt; and the &lt;a href=&quot;QXmlSimpleReader.html#parseContinue()&quot;&gt;&lt;tt&gt;parseContinue&lt;/tt&gt;&lt;/a&gt; function tries to read from that input source. Therefore, you should not delete the input source &lt;tt&gt;input&lt;/tt&gt; until you no longer need to call &lt;a href=&quot;QXmlSimpleReader.html#parseContinue()&quot;&gt;&lt;tt&gt;parseContinue&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If this function is called with &lt;tt&gt;incremental&lt;/tt&gt; set to true while an incremental parse is in progress, a new parsing session will be started, and the previous session will be lost.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#parseContinue()&quot;&gt;&lt;tt&gt;parseContinue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/network/QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean parse(com.trolltech.qt.xml.QXmlInputSource input)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public boolean parseContinue()" doc="/**
&lt;p&gt;Continues incremental parsing, taking input from the &lt;a href=&quot;QXmlInputSource.html&quot;&gt;&lt;tt&gt;QXmlInputSource&lt;/tt&gt;&lt;/a&gt; that was specified with the most recent call to &lt;a href=&quot;QXmlSimpleReader.html#parse(com.trolltech.qt.xml.QXmlInputSource)&quot;&gt;&lt;tt&gt;parse&lt;/tt&gt;&lt;/a&gt;. To use this function, you &lt;i&gt;must&lt;/i&gt; have called &lt;a href=&quot;QXmlSimpleReader.html#parse(com.trolltech.qt.xml.QXmlInputSource)&quot;&gt;&lt;tt&gt;parse&lt;/tt&gt;&lt;/a&gt; with the incremental argument set to true.&lt;/p&gt;
&lt;p&gt;Returns false if a parsing error occurs; otherwise returns true, even if the end of the XML file has not been reached. You can continue parsing at a later stage by calling this function again when there is more data available to parse.&lt;/p&gt;
&lt;p&gt;Calling this function when there is no data available in the input source indicates to the reader that the end of the XML file has been reached. If the input supplied up to this point was not well-formed then a parsing error occurs, and false is returned. If the input supplied was well-formed, true is returned. It is important to end the input in this way because it allows you to reuse the reader to parse other XML files.&lt;/p&gt;
&lt;p&gt;Calling this function after the end of file has been reached, but without available data will cause false to be returned whether the previous input was well-formed or not.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#parse(com.trolltech.qt.xml.QXmlInputSource)&quot;&gt;&lt;tt&gt;parse&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QXmlInputSource::data&lt;/tt&gt;
@see &lt;tt&gt;QXmlInputSource::next&lt;/tt&gt; */"/>
    <method name="public void setContentHandler(com.trolltech.qt.xml.QXmlContentHandlerInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#contentHandler()&quot;&gt;&lt;tt&gt;contentHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setDTDHandler(com.trolltech.qt.xml.QXmlDTDHandlerInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <method name="public void setDeclHandler(com.trolltech.qt.xml.QXmlDeclHandlerInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#declHandler()&quot;&gt;&lt;tt&gt;declHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setEntityResolver(com.trolltech.qt.xml.QXmlEntityResolverInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#entityResolver()&quot;&gt;&lt;tt&gt;entityResolver&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setErrorHandler(com.trolltech.qt.xml.QXmlErrorHandlerInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#errorHandler()&quot;&gt;&lt;tt&gt;errorHandler&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public void setFeature(java.lang.String name, boolean value)" doc="/**
&lt;p&gt;Turns on the feature &lt;tt&gt;name&lt;/tt&gt; if &lt;tt&gt;value&lt;/tt&gt; is true; otherwise turns it off.&lt;/p&gt;
&lt;p&gt;The &lt;tt&gt;name&lt;/tt&gt; parameter must be one of the following strings:&lt;/p&gt;
&lt;p&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; border=&quot;0&quot;&gt;
&lt;thead&gt;&lt;tr valign=&quot;top&quot; class=&quot;qt-style&quot;&gt;&lt;th&gt;Feature&lt;/th&gt;&lt;th&gt;Default&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tr valign=&quot;top&quot; class=&quot;odd&quot;&gt;&lt;td&gt;&lt;i&gt;http://xml.org/sax/features/namespaces&lt;/i&gt;&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;If enabled, namespaces are reported to the content handler.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot; class=&quot;even&quot;&gt;&lt;td&gt;&lt;i&gt;http://xml.org/sax/features/namespace-prefixes&lt;/i&gt;&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;If enabled, the original prefixed names and attributes used for namespace declarations are reported.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot; class=&quot;odd&quot;&gt;&lt;td&gt;&lt;i&gt;http://trolltech.com/xml/features/report-whitespace-only-CharData&lt;/i&gt;&lt;/td&gt;&lt;td&gt;true&lt;/td&gt;&lt;td&gt;If enabled, CharData that consist of only whitespace characters are reported using QXmlContentHandler::characters(). If disabled, whitespace is silently discarded.&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot; class=&quot;even&quot;&gt;&lt;td&gt;&lt;i&gt;http://trolltech.com/xml/features/report-start-end-entity&lt;/i&gt;&lt;/td&gt;&lt;td&gt;false&lt;/td&gt;&lt;td&gt;If enabled, the parser reports QXmlContentHandler::startEntity() and QXmlContentHandler::endEntity() events, so character data might be reported in chunks. If disabled, the parser does not report these events, but silently substitutes the entities, and reports the character data in one chunk.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#feature(java.lang.String)&quot;&gt;&lt;tt&gt;feature&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QXmlSimpleReader.html#hasFeature(java.lang.String)&quot;&gt;&lt;tt&gt;hasFeature&lt;/tt&gt;&lt;/a&gt;
@see SAX2 Features&lt;/tt&gt; */"/>
    <method name="public void setLexicalHandler(com.trolltech.qt.xml.QXmlLexicalHandlerInterface handler)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;

@see &lt;a href=&quot;QXmlSimpleReader.html#lexicalHandler()&quot;&gt;&lt;tt&gt;lexicalHandler&lt;/tt&gt;&lt;/a&gt; */"/>
</class>