diff options
author | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/xml-sax-features-walkthrough.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/xml-sax-features-walkthrough.html')
-rw-r--r-- | doc/html/xml-sax-features-walkthrough.html | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/doc/html/xml-sax-features-walkthrough.html b/doc/html/xml-sax-features-walkthrough.html index a8dd0995d..bba523426 100644 --- a/doc/html/xml-sax-features-walkthrough.html +++ b/doc/html/xml-sax-features-walkthrough.html @@ -56,23 +56,23 @@ namespace URIs. <p> Let's begin with the main program of the application. First the boring part: we include all the classes we need: <p> <pre> #include "structureparser.h" - #include <<a href="qapplication-h.html">qapplication.h</a>> - #include <<a href="qfile-h.html">qfile.h</a>> - #include <<a href="qxml-h.html">qxml.h</a>> - #include <<a href="qlistview-h.html">qlistview.h</a>> - #include <<a href="qgrid-h.html">qgrid.h</a>> - #include <<a href="qmainwindow-h.html">qmainwindow.h</a>> - #include <<a href="qlabel-h.html">qlabel.h</a>> + #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="qlistview-h.html">ntqlistview.h</a>> + #include <<a href="qgrid-h.html">ntqgrid.h</a>> + #include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> + #include <<a href="qlabel-h.html">ntqlabel.h</a>> </pre> <p> <a href="#structureparser.h">structureparser.h</a> contains the API of the XML parser that we implement in <a href="#structureparser.cpp">structureparser.cpp.</a> <p> <pre> int main( int argc, char **argv ) { - <a href="qapplication.html">TQApplication</a> app( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); </pre> <p> As usual we then create a TQt application object and hand command line arguments over to it. -<p> <pre> <a href="qfile.html">TQFile</a> xmlFile( argc == 2 ? argv[1] : "fnord.xml" ); +<p> <pre> <a href="ntqfile.html">TQFile</a> xmlFile( argc == 2 ? argv[1] : "fnord.xml" ); </pre> <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 @@ -84,7 +84,7 @@ the example directory for demonstration purposes. </pre> <p> ... and instantiate a <em>reader</em> object. Later we will manipulate its features and thus influence how the XML data are read. -<p> <pre> <a href="qgrid.html">TQGrid</a> * container = new <a href="qgrid.html">TQGrid</a>( 3 ); +<p> <pre> <a href="ntqgrid.html">TQGrid</a> * container = new <a href="ntqgrid.html">TQGrid</a>( 3 ); </pre> <p> Now let's think about presenting the output: As described in the <a href="xml.html#sax2Features">TQt SAX2 documentation</a> @@ -93,7 +93,7 @@ and <em>http://xml.org/sax/features/namespaces</em>: TRUE/TRUE, TRUE/FALSE and FALSE/TRUE. To show the relevant output side by side of each other and mark them with three labels makes up for a grid layout consisting of three columns (and thus two lines). -<p> <pre> <a href="qlistview.html">TQListView</a> * nameSpace = new <a href="qlistview.html">TQListView</a>( container, "table_namespace" ); +<p> <pre> <a href="ntqlistview.html">TQListView</a> * nameSpace = new <a href="ntqlistview.html">TQListView</a>( container, "table_namespace" ); </pre> <p> The most natural way of presenting XML elements is in a tree. Thus we use a listview. Its name <em>nameSpace</em> indicates that this @@ -118,12 +118,12 @@ in the parsed XML document. <p> <pre> reader.<a href="qxmlsimplereader.html#parse">parse</a>( source ); </pre> <p> Finally we parse the document with the reader's default feature settings. -<p> <pre> <a href="qlistview.html">TQListView</a> * namespacePrefix = new <a href="qlistview.html">TQListView</a>( container, +<p> <pre> <a href="ntqlistview.html">TQListView</a> * namespacePrefix = new <a href="ntqlistview.html">TQListView</a>( container, "table_namespace_prefix" ); </pre> <p> Now we prepare for the parsing of the same XML input source with different reader settings. The output will be presented in -a second <a href="qlistview.html">TQListView</a>, <em>namespacePrefix</em>. As it is the second +a second <a href="ntqlistview.html">TQListView</a>, <em>namespacePrefix</em>. As it is the second member of the <em>container</em> grid it will appear in the middle of the upper grid row. <p> <pre> handler->setListView( namespacePrefix ); @@ -145,7 +145,7 @@ beginning of the document again. </pre> <p> Finally we parse the XML file a second time with the changed reader settings (TRUE/TRUE). -<p> <pre> <a href="qlistview.html">TQListView</a> * prefix = new <a href="qlistview.html">TQListView</a>( container, "table_prefix"); +<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>(); @@ -155,21 +155,21 @@ settings (TRUE/TRUE). with the feature setting <em>http://xml.org/sax/features/namespaces</em> FALSE and <em>http://xml.org/sax/features/namespace-prefixes</em> TRUE. <p> <pre> // namespace label - (void) new <a href="qlabel.html">TQLabel</a>( + (void) new <a href="ntqlabel.html">TQLabel</a>( "Default:\n" "http://xml.org/sax/features/namespaces: TRUE\n" "http://xml.org/sax/features/namespace-prefixes: FALSE\n", container ); // namespace prefix label - (void) new <a href="qlabel.html">TQLabel</a>( + (void) new <a href="ntqlabel.html">TQLabel</a>( "\n" "http://xml.org/sax/features/namespaces: TRUE\n" "http://xml.org/sax/features/namespace-prefixes: TRUE\n", container ); // prefix label - (void) new <a href="qlabel.html">TQLabel</a>( + (void) new <a href="ntqlabel.html">TQLabel</a>( "\n" "http://xml.org/sax/features/namespaces: FALSE\n" "http://xml.org/sax/features/namespace-prefixes: TRUE\n", @@ -177,9 +177,9 @@ FALSE and <em>http://xml.org/sax/features/namespace-prefixes</em> TRUE. </pre> <p> The second row of the <em>container</em> grid is filled with three labels denoting the reader settings that belong to the above listview. -<p> <pre> app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( container ); - container-><a href="qwidget.html#show">show</a>(); - return app.<a href="qapplication.html#exec">exec</a>(); +<p> <pre> app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( container ); + container-><a href="ntqwidget.html#show">show</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> <p> Same procedure as with every TQt GUI program: the grid serves as the @@ -190,8 +190,8 @@ the GUI's event loop. <em>StructureParser</em>: <p> -<pre> #include <<a href="qxml-h.html">qxml.h</a>> - #include <<a href="qptrstack-h.html">qptrstack.h</a>> +<pre> #include <<a href="qxml-h.html">ntqxml.h</a>> + #include <<a href="qptrstack-h.html">ntqptrstack.h</a>> class TQListView; class TQListViewItem; @@ -203,26 +203,26 @@ the GUI's event loop. <p> We derive it from the <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a> class that implements a handler that simply does nothing. <p> <pre> public: - StructureParser( <a href="qlistview.html">TQListView</a> * ); + StructureParser( <a href="ntqlistview.html">TQListView</a> * ); </pre> <p> This makes it easy for us to implement only the functionality we in fact need. In our case this is the constructor that -takes a <a href="qlistview.html">TQListView</a> as an argument, -<p> <pre> bool startElement( const <a href="qstring.html">TQString</a>&, const <a href="qstring.html">TQString</a>&, const <a href="qstring.html">TQString</a>& , +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>& ); </pre> <p> the function to execute at the occurrence of element start tags (inherited from <a href="qxmlcontenthandler.html">TQXmlContentHandler</a>), and -<p> <pre> bool endElement( const <a href="qstring.html">TQString</a>&, const <a href="qstring.html">TQString</a>&, const <a href="qstring.html">TQString</a>& ); +<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. <p> All we have to implement so far is content handling. -<p> <pre> void setListView( <a href="qlistview.html">TQListView</a> * ); +<p> <pre> void setListView( <a href="ntqlistview.html">TQListView</a> * ); </pre> <p> In addition we have a function that selects a listview for the output. <p> <pre> private: - <a href="qptrstack.html">TQPtrStack</a><TQListViewItem> stack; + <a href="ntqptrstack.html">TQPtrStack</a><TQListViewItem> stack; </pre> <p> Keep in mind that we write a SAX2 parser that doesn't have an object model to keep all elements and attributes @@ -233,7 +233,7 @@ that haven't been closed yet. of TQListItems. An element will be added to the stack when its start tag appears and removed as soon as its end tag is parsed. -<p> <pre> <a href="qlistview.html">TQListView</a> * table; +<p> <pre> <a href="ntqlistview.html">TQListView</a> * table; }; </pre> <p> Apart from this we define a member variable that contains @@ -245,10 +245,10 @@ relevant functions. <pre> #include "structureparser.h" - #include <<a href="qstring-h.html">qstring.h</a>> - #include <<a href="qlistview-h.html">qlistview.h</a>> + #include <<a href="qstring-h.html">ntqstring.h</a>> + #include <<a href="qlistview-h.html">ntqlistview.h</a>> </pre> -<p> <pre> StructureParser::StructureParser( <a href="qlistview.html">TQListView</a> * t ) +<p> <pre> StructureParser::StructureParser( <a href="ntqlistview.html">TQListView</a> * t ) : <a href="qxmldefaulthandler.html">TQXmlDefaultHandler</a>() { </pre> @@ -257,10 +257,10 @@ its argument. <p> <pre> setListView( t ); } </pre> -<p> All we have to do here is to prepare the argument <a href="qlistview.html">TQListView</a> +<p> All we have to do here is to prepare the argument <a href="ntqlistview.html">TQListView</a> before usage. This we do with the <a href="#setListView()">setListView()</a> function. <p> <a name="setListView()"></a> -<pre> void StructureParser::setListView( <a href="qlistview.html">TQListView</a> * t ) +<pre> void StructureParser::setListView( <a href="ntqlistview.html">TQListView</a> * t ) { table = t; </pre> @@ -279,9 +279,9 @@ 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="qstring.html">TQString</a>& namespaceURI, - const <a href="qstring.html">TQString</a>& , - const <a href="qstring.html">TQString</a>& qName, +<p> <pre> bool StructureParser::<a href="qxmlcontenthandler.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) { </pre> @@ -331,7 +331,7 @@ Its listview item is therefore a direct child of the <p> Now we put the element's listview item on top of the stack. <p> <pre> element-><a href="qlistviewitem.html#setOpen">setOpen</a>( TRUE ); </pre> -<p> By default a <a href="qlistview.html">TQListView</a> presents all of its nodes closed. +<p> By default a <a href="ntqlistview.html">TQListView</a> presents all of its nodes closed. The user may then click on the <em>+</em> icon to see the child entries. <p> We however want to see the entire element tree @@ -355,8 +355,8 @@ 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="qstring.html">TQString</a>&, const <a href="qstring.html">TQString</a>&, - const <a href="qstring.html">TQString</a>& ) +<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>&, + const <a href="ntqstring.html">TQString</a>& ) { stack.pop(); </pre> |