You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Jose Luis Zabalza <jl...@gmail.com> on 2007/07/09 08:40:40 UTC

Get inner text

Hello

This is a novice question. How to get a DOMElement inner text ?

<DOC>
  <TAG1>


-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

Re: Get inner text

Posted by Jose Luis Zabalza <jl...@gmail.com>.
2007/7/12, Jesse Pelton <js...@pkc.com>:
> I don't think there's a simpler way.  Xerces implements the DOM specifications, which as far as I know do not specify such functionality.  The idea behind the specs is to give a reasonably complete set of tools that can be combined in many ways, rather than trying to provide all useful APIs.  Writing simpler, less capable APIs is left to you, because only you can know what the acceptable tradeoffs are.

OK. I agree. Thank you very munch for your help.


-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

RE: Get inner text

Posted by Jesse Pelton <js...@PKC.com>.
I don't think there's a simpler way.  Xerces implements the DOM specifications, which as far as I know do not specify such functionality.  The idea behind the specs is to give a reasonably complete set of tools that can be combined in many ways, rather than trying to provide all useful APIs.  Writing simpler, less capable APIs is left to you, because only you can know what the acceptable tradeoffs are.

But while it looks a bit scary at first, using serializers is not really very hard.

-----Original Message-----
From: Jose Luis Zabalza [mailto:jlz.3008@gmail.com] 
Sent: Thursday, July 12, 2007 6:39 AM
To: c-users@xerces.apache.org
Subject: Re: Get inner text

2007/7/10, David Bertoni <db...@apache.org>:

> Jose Luis Zabalza wrote:

> > I try ((DOMText *)element)->getWholeText() but y get a (0xFFFFFFFF)
> > pointer and the program crash.
> >
> > <D1>
> >  <D2>text</D2>
> >  <D3/>
> > <D1>
> >
> > if element is pointed to D1 I want get a text with
> >
> >  <D2>text</D2>
> >  <D3/>
>
> Then you need to use a serializer.  What version of Xerces-C are you using?
>

  OK. I watch DOMPrint example and I see DOMWriter example. It's OK
and fullfeatured but too munch complicated. Is there  another simpler
manner to get inner text?

Thanks in avance

-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

Re: Get inner text

Posted by Jose Luis Zabalza <jl...@gmail.com>.
2007/7/10, David Bertoni <db...@apache.org>:

> Jose Luis Zabalza wrote:

> > I try ((DOMText *)element)->getWholeText() but y get a (0xFFFFFFFF)
> > pointer and the program crash.
> >
> > <D1>
> >  <D2>text</D2>
> >  <D3/>
> > <D1>
> >
> > if element is pointed to D1 I want get a text with
> >
> >  <D2>text</D2>
> >  <D3/>
>
> Then you need to use a serializer.  What version of Xerces-C are you using?
>

  OK. I watch DOMPrint example and I see DOMWriter example. It's OK
and fullfeatured but too munch complicated. Is there  another simpler
manner to get inner text?

Thanks in avance

-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

Re: Get inner text

Posted by Jose Luis Zabalza <jl...@gmail.com>.
Thanks for your response.

2007/7/10, David Bertoni <db...@apache.org>:

> Then you need to use a serializer.  What version of Xerces-C are you using?

Serializer. Hummmm!. I am going to throw a look.

Version Xerces-C   ->  2.7.0 bundled with Debian Etch


-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

Re: Get inner text

Posted by David Bertoni <db...@apache.org>.
Jose Luis Zabalza wrote:
> Thanks for your response. I must request excuses because I send the
> email without finish it.
> 
> I want get text **with** markup inside. With getTextContent() only get
> the text, obiously ;-).
> I try ((DOMText *)element)->getWholeText() but y get a (0xFFFFFFFF)
> pointer and the program crash.
> 
> <D1>
>  <D2>text</D2>
>  <D3/>
> <D1>
> 
> if element is pointed to D1 I want get a text with
> 
>  <D2>text</D2>
>  <D3/>
Then you need to use a serializer.  What version of Xerces-C are you using?

Dave

Re: Get inner text

Posted by Jose Luis Zabalza <jl...@gmail.com>.
Thanks for your response. I must request excuses because I send the
email without finish it.

I want get text **with** markup inside. With getTextContent() only get
the text, obiously ;-).
I try ((DOMText *)element)->getWholeText() but y get a (0xFFFFFFFF)
pointer and the program crash.

<D1>
  <D2>text</D2>
  <D3/>
<D1>

if element is pointed to D1 I want get a text with

  <D2>text</D2>
  <D3/>

Thanks in avance

2007/7/9, Jesse Pelton <js...@pkc.com>:
> DOMNode::getTextContent() may do what you need.  Failing that, loop through the element's children.  Call getNodeType() on each and process any whose type is DOMNode::TEXT_NODE.
>
> -----Original Message-----
> From: Jose Luis Zabalza [mailto:jlz.3008@gmail.com]
> Sent: Monday, July 09, 2007 2:41 AM
> To: c-users@xerces.apache.org
> Subject: Get inner text
>
> Hello
>
> This is a novice question. How to get a DOMElement inner text ?
>
> --
> José Luis Zabalza
> jlz.3008  a t  gmail.com
> Linux Counter 172551
>


-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551

RE: Get inner text

Posted by Jesse Pelton <js...@PKC.com>.
DOMNode::getTextContent() may do what you need.  Failing that, loop through the element's children.  Call getNodeType() on each and process any whose type is DOMNode::TEXT_NODE. 

-----Original Message-----
From: Jose Luis Zabalza [mailto:jlz.3008@gmail.com] 
Sent: Monday, July 09, 2007 2:41 AM
To: c-users@xerces.apache.org
Subject: Get inner text

Hello

This is a novice question. How to get a DOMElement inner text ?

<DOC>
  <TAG1>


-- 
José Luis Zabalza
jlz.3008  a t  gmail.com
Linux Counter 172551