Hi,
I failed to read the C++ doc about QXmlStreamReader and understand how 
this should work. On the internet there simply isn't any help about 
qt-jambi and QXmlStreamReader so i have to resort to You.

I want to read and print out the <para> tagged contents of my file:
<?xml version="1.0"?>
<Objects>
<para>Table</para>
<para>Floor</para>
<para>Wall</para>
<para>Chair</para>
</Objects>


So i wrote:

QXmlStreamReader xml = new QXmlStreamReader("C:\\Documents and 
Settings\\Dawid\\workspace\\Annotation\\example.xml");
       
        QXmlStreamReader.TokenType tokenType;
        String name;

        while(!xml.atEnd())
        {
                tokenType = xml.readNext();

                name = xml.name();

                if(tokenType == QXmlStreamReader.TokenType.StartElement)
                {
                        if(name == "para")
                            System.out.println(xml.tokenString()+ " para");
                }

        }
         if (xml.hasError()) {
             System.out.println(xml.errorString()+", line num. 
"+xml.lineNumber()+" column "+xml.columnNumber()+" character off 
"+xml.characterOffset());
         }

And im getting an immidiate error saying 'Start tag expected'. Naturally 
the doc does not say anything about such error so I have no idea whats 
goind on..?
Can someone explain me how to read the xml contents with qt-jambi.

Dave
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to