Qt-interest Archive, April 2007
QtXml
Message 1 in thread
Hello there:
I am a Qt-newbie and although I managed to read in an xml file I cannot
for example process the data except for displaying them. Would be
interesting for instance to assign several tags to variables or count
the number of tags that have been read. Any help would be appreciated!
Kind Regards,
lb
--
[ signature omitted ]
Message 2 in thread
Lara,
Please don't double post the same exact question. If you don't get any
responses to your question the first time, it's probably because the
question is off-topic, hard to understand, easily answerable by existing
documentation, or no one on the list knows the answer or can figure it out
in a reasonable amount of time. Looking at your question, it is probably
because it isn't clear what your asking.
Tom
On 4/23/07, Lara Braun <parmanax@xxxxxxxxxxxxxx> wrote:
>
> Hello there:
>
> I am a Qt-newbie and although I managed to read in an xml file I cannot
> for example process the data except for displaying them. Would be
> interesting for instance to assign several tags to variables or count
> the number of tags that have been read. Any help would be appreciated!
>
> Kind Regards,
> lb
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
Message 3 in thread
Lara Braun schrieb:
> Hello there:
>
> I am a Qt-newbie and although I managed to read in an xml file I cannot
> for example process the data except for displaying them. Would be
> interesting for instance to assign several tags to variables or count
Can you explain what you mean with "assign several tags to variables"?
What by your definition are variables? How can you "assign" a tag to a
variable? Maybe if you could post a short XML snipped which demonstrates
what you are trying to achieve would already help.
> the number of tags that have been read. Any help would be appreciated!
I assume you are interested in the number of everything which looks like
<something> (closing tags not counted) in an XML document. Since the
tags map to QDomNode the task would be to recursively iterate over the
QDomDocument and count the number of QDomNodes (use QDomNode::childNodes
etc.).
If you want to know this number at "parse time" then you would probably
implement your own SAX parser (derive from the existing framework) and
keep track of the count (QXmlReader, QXmlContentHandler).
p.s. Your question really falls into the two categories "hard to
undertand" and "It's all in the manual"
--
[ signature omitted ]