This really helps Ragunath.
I was thinking in an implemented method not in any piece of
code...probably... I am too lazy.
Thanks.
----- Original Message -----
From: "Ragunath Marudhachalam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 3:41 PM
Subject: RE: Accessing to a specific child Element
> Hi i wrote a utility function like this, to get the specified node
value...
>
> public static final String getFirstNodeValue(Node p, String s) {
> Node e = getFirstNode(p, s);
> Node c = (e != null) ? e.getFirstChild() : null;
> return (c != null) ? c.getNodeValue() : "";
> }
>
>
> public static final Node getFirstNode(Node p, String s) {
> NodeList list = p.getChildNodes();
> if (list != null) for (int i=0; i<list.getLength(); i++) {
> Node node = list.item(i);
> if (node.getNodeName().compareTo(s) == 0)
> return node;
> }
> return null;
> }
>
>
> Hope this helps!!!!!
>
>
>
>
>
> -----Original Message-----
> From: Iban Torres [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 08, 2001 10:31 AM
> To: [EMAIL PROTECTED]
> Subject: Accessing to a specific child Element
>
>
> Hi all.
>
> Single question. I'd like to access to a specific child Element.
Knowing
> that you have one and only one Element with the desired Tag Name, how can
I
> get 'that' Element?.
> I know that I can use getElementsByTagName(String), but ,as you know
it
> returns a NodeList, so I have to declare a NodeList.
> Any shorter way to do it?
>
> Thanks in advance.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]