Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, February 2007
Getting value of element


Message 1 in thread

Hi,
I'm using Qt 3.3 SAX to parse a XML file and I've reimplemented
startElement and endElement but I can't seem to understand where to
get the value for the element. Which means that in <body>Hello</body>,
I can't get the 'Hello' part. Any suggestions?

Cheers,
-- 
 [ signature omitted ] 

Message 2 in thread

On 03.02.07 12:07:26, Paulo J. Matos wrote:
> Hi,
> I'm using Qt 3.3 SAX to parse a XML file and I've reimplemented
> startElement and endElement but I can't seem to understand where to
> get the value for the element. Which means that in <body>Hello</body>,
> I can't get the 'Hello' part. Any suggestions?

There's no such thing as "value" of an element. An element has child
nodes, which might be either elements themselves or text. In your
example the content is 1 text node. The content handler has the
characters method to handle a chunk of text, so you want to override
that.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

On 2/3/07, Andreas Pakulat <apaku@xxxxxx> wrote:
> On 03.02.07 12:07:26, Paulo J. Matos wrote:
> > Hi,
> > I'm using Qt 3.3 SAX to parse a XML file and I've reimplemented
> > startElement and endElement but I can't seem to understand where to
> > get the value for the element. Which means that in <body>Hello</body>,
> > I can't get the 'Hello' part. Any suggestions?
>
> There's no such thing as "value" of an element. An element has child
> nodes, which might be either elements themselves or text. In your
> example the content is 1 text node. The content handler has the
> characters method to handle a chunk of text, so you want to override
> that.
>

Yes, that's what I wanted... the content! :-) missed the correct word.
Thanks, that's exactly the method I was searching for.

Paulo Matos

> Andreas
>
> --
> Are you ever going to do the dishes?  Or will you change your major to biology?
>
> --
> 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/
>
>
>
>


-- 
 [ signature omitted ]