diff options
Diffstat (limited to 'doc/html/xml-sax-features-walkthrough.html')
-rw-r--r-- | doc/html/xml-sax-features-walkthrough.html | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/doc/html/xml-sax-features-walkthrough.html b/doc/html/xml-sax-features-walkthrough.html index bba523426..6eb02b099 100644 --- a/doc/html/xml-sax-features-walkthrough.html +++ b/doc/html/xml-sax-features-walkthrough.html @@ -58,7 +58,7 @@ part: we include all the classes we need: <p> <pre> #include "structureparser.h" #include <<a href="qapplication-h.html">ntqapplication.h</a>> #include <<a href="qfile-h.html">ntqfile.h</a>> - #include <<a href="qxml-h.html">ntqxml.h</a>> + #include <<a href="tqxml-h.html">tqxml.h</a>> #include <<a href="qlistview-h.html">ntqlistview.h</a>> #include <<a href="qgrid-h.html">ntqgrid.h</a>> #include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> @@ -77,10 +77,10 @@ over to it. <p> If the user runs the program with one filename as an argument we process this file, otherwise we use the <em>fnord.xml</em> file from the example directory for demonstration purposes. -<p> <pre> <a href="qxmlinputsource.html">TQXmlInputSource</a> source( &xmlFile ); +<p> <pre> <a href="tqxmlinputsource.html">TQXmlInputSource</a> source( &xmlFile ); </pre> <p> We use <em>xmlFile</em> as the XML Input Source... -<p> <pre> <a href="qxmlsimplereader.html">TQXmlSimpleReader</a> reader; +<p> <pre> <a href="tqxmlsimplereader.html">TQXmlSimpleReader</a> reader; </pre> <p> ... and instantiate a <em>reader</em> object. Later we will manipulate its features and thus influence how the XML data are read. @@ -99,23 +99,23 @@ of three columns (and thus two lines). Thus we use a listview. Its name <em>nameSpace</em> indicates that this one will be used to present the combination of <em>http://xml.org/sax/features/namespaces</em> being TRUE and <em>http://xml.org/sax/features/namespace-prefixes</em> -being FALSE -- the default configuration of a <a href="qxmlsimplereader.html">TQXmlSimpleReader</a>. +being FALSE -- the default configuration of a <a href="tqxmlsimplereader.html">TQXmlSimpleReader</a>. <p> Being the first grid entry the <em>nameSpace</em> listview will appear in the upper left corner of the virtual grid. <p> <pre> StructureParser * handler = new StructureParser( nameSpace ); </pre> <p> Then we create a handler that deals with the XML data read by the reader. -As the provided handler class <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> simply does nothing +As the provided handler class <a href="tqxmldefaulthandler.html">TQXmlDefaultHandler</a> simply does nothing with the data from the reader, we can't use it right away. Instead we have to subclass our own <a href="#structureparser.cpp">StructureParser</a> from it. -<p> <pre> reader.<a href="qxmlreader.html#setContentHandler">setContentHandler</a>( handler ); +<p> <pre> reader.<a href="tqxmlreader.html#setContentHandler">setContentHandler</a>( handler ); </pre> <p> The <em>handler</em> serves as content handler for the reader. Note that for simplicity reasons we don't register e.g. an error handler. Thus our program will not complain about for example missing closing tags in the parsed XML document. -<p> <pre> reader.<a href="qxmlsimplereader.html#parse">parse</a>( source ); +<p> <pre> reader.<a href="tqxmlsimplereader.html#parse">parse</a>( source ); </pre> <p> Finally we parse the document with the reader's default feature settings. <p> <pre> <a href="ntqlistview.html">TQListView</a> * namespacePrefix = new <a href="ntqlistview.html">TQListView</a>( container, @@ -130,26 +130,26 @@ the upper grid row. </pre> <p> Then we ask the <em>handler</em> to present the data in the <em>namespacePrefix</em> listview. -<p> <pre> <a name="x2125"></a> reader.<a href="qxmlsimplereader.html#setFeature">setFeature</a>( "http://xml.org/sax/features/namespace-prefixes", +<p> <pre> <a name="x2125"></a> reader.<a href="tqxmlsimplereader.html#setFeature">setFeature</a>( "http://xml.org/sax/features/namespace-prefixes", TRUE ); </pre> <p> Now we modify the behaviour of the <em>reader</em> and change <em>http://xml.org/sax/features/namespace-prefixes</em> from the default FALSE to TRUE. The <em>http://xml.org/sax/features/namespaces</em> feature has still its default setting TRUE. -<p> <pre> source.<a href="qxmlinputsource.html#reset">reset</a>(); +<p> <pre> source.<a href="tqxmlinputsource.html#reset">reset</a>(); </pre> <p> We have to reset the input source to make the new parsing start from the beginning of the document again. -<p> <pre> reader.<a href="qxmlsimplereader.html#parse">parse</a>( source ); +<p> <pre> reader.<a href="tqxmlsimplereader.html#parse">parse</a>( source ); </pre> <p> Finally we parse the XML file a second time with the changed reader settings (TRUE/TRUE). <p> <pre> <a href="ntqlistview.html">TQListView</a> * prefix = new <a href="ntqlistview.html">TQListView</a>( container, "table_prefix"); handler->setListView( prefix ); - reader.<a href="qxmlsimplereader.html#setFeature">setFeature</a>( "http://xml.org/sax/features/namespaces", FALSE ); - source.<a href="qxmlinputsource.html#reset">reset</a>(); - reader.<a href="qxmlsimplereader.html#parse">parse</a>( source ); + reader.<a href="tqxmlsimplereader.html#setFeature">setFeature</a>( "http://xml.org/sax/features/namespaces", FALSE ); + source.<a href="tqxmlinputsource.html#reset">reset</a>(); + reader.<a href="tqxmlsimplereader.html#parse">parse</a>( source ); </pre> <p> Next we prepare and use the upper right listview to show the reader results with the feature setting <em>http://xml.org/sax/features/namespaces</em> @@ -190,17 +190,17 @@ the GUI's event loop. <em>StructureParser</em>: <p> -<pre> #include <<a href="qxml-h.html">ntqxml.h</a>> +<pre> #include <<a href="tqxml-h.html">tqxml.h</a>> #include <<a href="qptrstack-h.html">ntqptrstack.h</a>> class TQListView; class TQListViewItem; class TQString; </pre> -<p> <pre> class StructureParser: public <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> +<p> <pre> class StructureParser: public <a href="tqxmldefaulthandler.html">TQXmlDefaultHandler</a> { </pre> -<p> We derive it from the <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> class that +<p> We derive it from the <a href="tqxmldefaulthandler.html">TQXmlDefaultHandler</a> class that implements a handler that simply does nothing. <p> <pre> public: StructureParser( <a href="ntqlistview.html">TQListView</a> * ); @@ -209,10 +209,10 @@ implements a handler that simply does nothing. we in fact need. In our case this is the constructor that takes a <a href="ntqlistview.html">TQListView</a> as an argument, <p> <pre> bool startElement( const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>& , - const <a href="qxmlattributes.html">TQXmlAttributes</a>& ); + const <a href="tqxmlattributes.html">TQXmlAttributes</a>& ); </pre> <p> the function to execute at the occurrence of element start tags -(inherited from <a href="qxmlcontenthandler.html">TQXmlContentHandler</a>), and +(inherited from <a href="tqxmlcontenthandler.html">TQXmlContentHandler</a>), and <p> <pre> bool endElement( const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>& ); </pre> <p> the code to run when an end tag occurs. @@ -249,7 +249,7 @@ relevant functions. #include <<a href="qlistview-h.html">ntqlistview.h</a>> </pre> <p> <pre> StructureParser::StructureParser( <a href="ntqlistview.html">TQListView</a> * t ) - : <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a>() + : <a href="tqxmldefaulthandler.html">TQXmlDefaultHandler</a>() { </pre> <p> First we have the constructor that takes a listview pointer as @@ -279,10 +279,10 @@ element's or attribute's qualified names and one for their namespace URIs. Columns are added from left to right and with the title as an argument. <p> Now let's deal with XML content handling. -<p> <pre> bool StructureParser::<a href="qxmlcontenthandler.html#startElement">startElement</a>( const <a href="ntqstring.html">TQString</a>& namespaceURI, +<p> <pre> bool StructureParser::<a href="tqxmlcontenthandler.html#startElement">startElement</a>( const <a href="ntqstring.html">TQString</a>& namespaceURI, const <a href="ntqstring.html">TQString</a>& , const <a href="ntqstring.html">TQString</a>& qName, - const <a href="qxmlattributes.html">TQXmlAttributes</a>& attributes) + const <a href="tqxmlattributes.html">TQXmlAttributes</a>& attributes) { </pre> <p> When we come across the start tag of an element the handler does @@ -337,11 +337,11 @@ entries. <p> We however want to see the entire element tree at once when we run the program. Therefore we open each listview item manually. -<p> <pre> if ( attributes.<a href="qxmlattributes.html#length">length</a>() > 0 ) { +<p> <pre> if ( attributes.<a href="tqxmlattributes.html#length">length</a>() > 0 ) { </pre> <p> What do we do if an element has attributes? -<p> <pre> <a name="x2105"></a> for ( int i = 0 ; i < attributes.<a href="qxmlattributes.html#length">length</a>(); i++ ) { - <a name="x2107"></a><a name="x2106"></a> new <a href="qlistviewitem.html">TQListViewItem</a>( element, attributes.<a href="qxmlattributes.html#qName">qName</a>(i), attributes.<a href="qxmlattributes.html#uri">uri</a>(i) ); +<p> <pre> <a name="x2105"></a> for ( int i = 0 ; i < attributes.<a href="tqxmlattributes.html#length">length</a>(); i++ ) { + <a name="x2107"></a><a name="x2106"></a> new <a href="qlistviewitem.html">TQListViewItem</a>( element, attributes.<a href="tqxmlattributes.html#qName">qName</a>(i), attributes.<a href="tqxmlattributes.html#uri">uri</a>(i) ); } } </pre> @@ -355,7 +355,7 @@ the current <em>element</em>. <p> To prevent the reader from throwing an error we have to return TRUE when we successfully dealt with an element's start tag. -<p> <pre> bool StructureParser::<a href="qxmlcontenthandler.html#endElement">endElement</a>( const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>&, +<p> <pre> bool StructureParser::<a href="tqxmlcontenthandler.html#endElement">endElement</a>( const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>&, const <a href="ntqstring.html">TQString</a>& ) { stack.pop(); |