We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › help with ProXML
Page Index Toggle Pages: 1
help with ProXML (Read 655 times)
help with ProXML
Feb 28th, 2006, 1:10am
 
Hi,

can someone tell me how can i retrive the data (event running all day) inside a node like:<Text Date="16-02-2006">event running all day</Text>,

using porXML?

Thanx
Re: help with ProXML
Reply #1 - Feb 28th, 2006, 2:42am
 
I can't typ much bcaus my kboard crappity smackd from t3a spill.

but WOULDN'T YOU US3:

getChild(0).getElement()

ON THAT NOD3?
Re: help with ProXML
Reply #2 - Feb 28th, 2006, 12:31pm
 
Unfortunaly using getElement ( ) it will return the nam of the Element.. in this case "Text" and not the actual content .. i need to now how tio access the PCDTA on a node that has atributes to...

help please
Re: help with ProXML
Reply #3 - Feb 28th, 2006, 9:09pm
 
That's where getChild(0) comes in.

That will only work where the text node is the only child of the node you're currently at (as was the case in your example).

The documentation says:

description
Use this method to get the name of a XMLElement. If the XMLElement is a PCDATA section getElement() gives you its text.

So, in the case of your example, to retrieve the text you'd do:

String text = yournodeobjectname.getChild(0).getElement();

If you have more than one children in the actual nodes you're working with then you need to loop through them. You can use:

isPCDATA();

To check for text before retrieving it (returns true if it finds PCDATA).



Re: help with ProXML
Reply #4 - Feb 28th, 2006, 9:12pm
 
Just to explain a bit better. In your example:

<Text Date="16-02-2006">event running all day</Text>

The text "event running all day" is a node in itself (i.e. not only tags are nodes). It's the first (and in this case only) child of the node <Text>.
Re: help with ProXML
Reply #5 - Feb 28th, 2006, 10:55pm
 
Many thanx for the explanation. it worked just fine Cheesy
Page Index Toggle Pages: 1