From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/xml-sax-features-walkthrough.html | 80 +++++++++++++++--------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'doc/html/xml-sax-features-walkthrough.html') 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.

Let's begin with the main program of the application. First the boring part: we include all the classes we need:

    #include "structureparser.h"
-    #include <qapplication.h>
-    #include <qfile.h>
-    #include <qxml.h>
-    #include <qlistview.h>
-    #include <qgrid.h>
-    #include <qmainwindow.h>
-    #include <qlabel.h>
+    #include <ntqapplication.h>
+    #include <ntqfile.h>
+    #include <ntqxml.h>
+    #include <ntqlistview.h>
+    #include <ntqgrid.h>
+    #include <ntqmainwindow.h>
+    #include <ntqlabel.h>
 

structureparser.h contains the API of the XML parser that we implement in structureparser.cpp.

    int main( int argc, char **argv )
     {
-        TQApplication app( argc, argv );
+        TQApplication app( argc, argv );
 

As usual we then create a TQt application object and hand command line arguments over to it. -

        TQFile xmlFile( argc == 2 ? argv[1] : "fnord.xml" );
+

        TQFile xmlFile( argc == 2 ? argv[1] : "fnord.xml" );
 

If the user runs the program with one filename as an argument we process this file, otherwise we use the fnord.xml file from @@ -84,7 +84,7 @@ the example directory for demonstration purposes.

... and instantiate a reader object. Later we will manipulate its features and thus influence how the XML data are read. -

        TQGrid * container = new TQGrid( 3 );
+

        TQGrid * container = new TQGrid( 3 );
 

Now let's think about presenting the output: As described in the TQt SAX2 documentation @@ -93,7 +93,7 @@ and http://xml.org/sax/features/namespaces: 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). -

        TQListView * nameSpace = new TQListView( container, "table_namespace" );
+

        TQListView * nameSpace = new TQListView( container, "table_namespace" );
 

The most natural way of presenting XML elements is in a tree. Thus we use a listview. Its name nameSpace indicates that this @@ -118,12 +118,12 @@ in the parsed XML document.

        reader.parse( source );
 

Finally we parse the document with the reader's default feature settings. -

        TQListView * namespacePrefix = new TQListView( container,
+

        TQListView * namespacePrefix = new TQListView( container,
                                                      "table_namespace_prefix" );
 

Now we prepare for the parsing of the same XML input source with different reader settings. The output will be presented in -a second TQListView, namespacePrefix. As it is the second +a second TQListView, namespacePrefix. As it is the second member of the container grid it will appear in the middle of the upper grid row.

        handler->setListView( namespacePrefix );
@@ -145,7 +145,7 @@ beginning of the document again.
 

Finally we parse the XML file a second time with the changed reader settings (TRUE/TRUE). -

        TQListView * prefix = new TQListView( container, "table_prefix");
+

        TQListView * prefix = new TQListView( container, "table_prefix");
         handler->setListView( prefix );
         reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE );
         source.reset();
@@ -155,21 +155,21 @@ settings (TRUE/TRUE).
 with the feature setting http://xml.org/sax/features/namespaces
 FALSE and http://xml.org/sax/features/namespace-prefixes TRUE.
 

        // namespace label
-        (void) new TQLabel(
+        (void) new TQLabel(
                  "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 TQLabel(
+        (void) new TQLabel(
                  "\n"
                  "http://xml.org/sax/features/namespaces: TRUE\n"
                  "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
                  container );
 
         // prefix label
-        (void) new TQLabel(
+        (void) new TQLabel(
                  "\n"
                  "http://xml.org/sax/features/namespaces: FALSE\n"
                  "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
@@ -177,9 +177,9 @@ FALSE and http://xml.org/sax/features/namespace-prefixes TRUE.
 

The second row of the container grid is filled with three labels denoting the reader settings that belong to the above listview. -

        app.setMainWidget( container );
-        container->show();
-        return app.exec();
+

        app.setMainWidget( container );
+        container->show();
+        return app.exec();
     }
 

Same procedure as with every TQt GUI program: the grid serves as the @@ -190,8 +190,8 @@ the GUI's event loop. StructureParser:

-

    #include <qxml.h>
-    #include <qptrstack.h>
+
    #include <ntqxml.h>
+    #include <ntqptrstack.h>
 
     class TQListView;
     class TQListViewItem;
@@ -203,26 +203,26 @@ the GUI's event loop.
 

We derive it from the TQXmlDefaultHandler class that implements a handler that simply does nothing.

    public:
-        StructureParser( TQListView * );
+        StructureParser( TQListView * );
 

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 TQListView as an argument, -

        bool startElement( const TQString&, const TQString&, const TQString& ,
+takes a TQListView as an argument,
+

        bool startElement( const TQString&, const TQString&, const TQString& ,
                            const TQXmlAttributes& );
 

the function to execute at the occurrence of element start tags (inherited from TQXmlContentHandler), and -

        bool endElement( const TQString&, const TQString&, const TQString& );
+

        bool endElement( const TQString&, const TQString&, const TQString& );
 

the code to run when an end tag occurs.

All we have to implement so far is content handling. -

        void setListView( TQListView * );
+

        void setListView( TQListView * );
 

In addition we have a function that selects a listview for the output.

    private:
-        TQPtrStack<TQListViewItem> stack;
+        TQPtrStack<TQListViewItem> stack;
 

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. -

        TQListView * table;
+

        TQListView * table;
     };
 

Apart from this we define a member variable that contains @@ -245,10 +245,10 @@ relevant functions.

    #include "structureparser.h"
 
-    #include <qstring.h>
-    #include <qlistview.h>
+    #include <ntqstring.h>
+    #include <ntqlistview.h>
 
-

    StructureParser::StructureParser( TQListView * t )
+

    StructureParser::StructureParser( TQListView * t )
                     : TQXmlDefaultHandler()
     {
 
@@ -257,10 +257,10 @@ its argument.

        setListView( t );
     }
 
-

All we have to do here is to prepare the argument TQListView +

All we have to do here is to prepare the argument TQListView before usage. This we do with the setListView() function.

-

    void StructureParser::setListView( TQListView * t )
+
    void StructureParser::setListView( TQListView * t )
     {
         table = t;
 
@@ -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.

Now let's deal with XML content handling. -

    bool StructureParser::startElement( const TQString& namespaceURI,
-                                        const TQString& ,
-                                        const TQString& qName,
+

    bool StructureParser::startElement( const TQString& namespaceURI,
+                                        const TQString& ,
+                                        const TQString& qName,
                                         const TQXmlAttributes& attributes)
     {
 
@@ -331,7 +331,7 @@ Its listview item is therefore a direct child of the

Now we put the element's listview item on top of the stack.

        element->setOpen( TRUE );
 
-

By default a TQListView presents all of its nodes closed. +

By default a TQListView presents all of its nodes closed. The user may then click on the + icon to see the child entries.

We however want to see the entire element tree @@ -355,8 +355,8 @@ the current element.

To prevent the reader from throwing an error we have to return TRUE when we successfully dealt with an element's start tag. -

    bool StructureParser::endElement( const TQString&, const TQString&,
-                                      const TQString& )
+

    bool StructureParser::endElement( const TQString&, const TQString&,
+                                      const TQString& )
     {
         stack.pop();
 
-- cgit v1.2.1