Method getTextValue() returns for a startElement the entire text of the subtree 
as it javadocs says.

The idea is to move the cursor to the right place and get it:

 

        if (!cursor.toNextToken().isNone())

        {

            do

            {

                System.out.println(" c-> " + cursor.currentTokenType());

                if (cursor.isStart())

                    cursor.toEndToken();

                else if (cursor.isText())

                    System.out.println("Text " + cursor.getTextValue());

            }

            while(!cursor.toNextToken().isNone());

        }

 

Cezar

 

________________________________

From: Ezequiel Puig [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 2:46 AM
To: dev@xmlbeans.apache.org
Subject: RE : How to get the info

 

Hi, 

 

That's what i have done :

 

XmlCursor cursor = textDescription.newCursor();

String text = cursor.getTextValue().trim();

cursor.dispose();

 

where textDescription is the <Description> node.

 

But in the variable "text" i am recupering: "Title text    How do I acces here 
?? http://google.com <http://google.com/> ".

 

So, there is not an easy form to extract the text i want :-(

 

Do you know any other way to do it ??

 

Anyway, thanks for the answer.

 

 

Ezequiel.

 

 

-----Message d'origine-----
De : Vinh Nguyen (vinguye2) [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 8 août 2007 20:56
À : dev@xmlbeans.apache.org
Objet : RE: How to get the info

 

I think using XmlCursor, you can call getTextValue() on the <Descriptions> 
node.  This will basically get you all the text values that are dangling 
between this node's child nodes.

 

________________________________

From: Ezequiel Puig [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 08, 2007 8:15 AM
To: dev@xmlbeans.apache.org
Subject: How to get the info

Hi,

 

I am really new in XMLBeans, so probably this is an easy question:

 

I have the following piece of XML:

 

<Descriptions>

        <Description Role="Summary">

          <Title>Title text</Title>

          How do I acces here ??

          <Media>

            <URL>http://www.google.com</URL>

          </Media>

        </Description>

<Descriptions>

 

XMLBeans has created for me methods like getDescription(), gerRole, getTitle, 
getMedia, etc. But my prolem is that i don't know how to get the piece of text 
"How do I acces here ??" ??


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

Reply via email to