Hi karthikeyan,

Check if the node is a text node and if yes, call getNodeValue().
Hope this solves your problem.

Regards,
Pavani


> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> list-help: <mailto:[EMAIL PROTECTED]>
> list-unsubscribe: <mailto:[EMAIL PROTECTED]>
> list-post: <mailto:[EMAIL PROTECTED]>
> Delivered-To: mailing list [EMAIL PROTECTED]
> From: "karthikeyan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Re: JSP XML
> Date: Tue, 21 Aug 2001 19:42:04 +0530
> Content-Transfer-Encoding: 7bit
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
> X-MDaemon-Deliver-To: [EMAIL PROTECTED]
> X-Return-Path: [EMAIL PROTECTED]
> X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N
> 
> Hi Lakshmi,
> 
>   Thanx for your mail.
> 
>   Just few things :
>   1. what are all the packages i need to import for this method, i have
> xerces.jar in my classpath and another doubt
>   2. if i need only elementValue i just have to say :
>       private String traverse(Node node)
> 
> 
>      return elementValue;
>      } and return elementValue right.
> 
>   Waiting for your earliest reply,
> 
>   Thanx Once again.
> 
>   With Regards,
> 
> b.karthikeyan.
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 21, 2001 1:11 PM
> Subject: Re: JSP XML
> 
> 
> >
> >
> > Hi Karthikeyan,
> >
> > This is with regard to your query for getting the content of the tag/node
> > "CurrentPage". Using DOM API Xerces allows navigation along the nodes of
> an
> > XML document. You traverse to the required - "CurrentPage" and get the
> > contents using the method getNodeValue() of the Node class.
> >
> > Eg:-
> >
> >      private void traverse (Node node)
> >      {
> >           int type = node.getNodeType();
> >           if (type == Node.ELEMENT_NODE)
> >           {
> >                elementName = node.getNodeName();
> >                elementValue = node.getNodeValue();
> >           }
> >           NodeList children = node.getChildNodes();
> >           if (children != null)
> >           {
> >                for (int i=0; i< children.getLength(); i++)
> >                {
> >                     traverse(children.item(i));
> >                }
> >           }
> >      }//End of traverse
> >
> > If any clarification is required, you are always welcome !
> >
> > Regards,
> >
> > R.Lakshmi
> >
> >
> >
> >
> >
> >
> >
> >                     "karthikeyan"
> >                     <karthikeyan@aspi        To:
> <[EMAIL PROTECTED]>
> >                     resys.com>               cc:
> 
> >                                              Subject:     JSP XML
> >                     20/08/2001 07:41
> >                     PM
> >                     Please respond to
> >                     xerces-j-dev
> >
> >
> >
> >
> >
> > Hi Guys,
> >
> >   I need an help.  I have this XML Schema.
> >
> >     <ResultHeader>
> >       <MemberID>12345</MemberID>
> >       <SearchType>quick</SearchType>
> >       <Result>success</Result>
> >       <CurrentPage>5</CurrentPage>
> >       <TotalPages>10</TotalPages>
> >     </ResultHeader>
> >
> >   I just want to read CurrentPage and TotalPages element content and
> > display
> > in my JSP page.  Before that i need to store this data in a String.  For
> > example currentPage = <CurrentPage> element content which here is 5,
> > likewise.
> >
> >   Is there any method in Xerces where you just say :
> > getElementContent("<CurrentPage>") and you will get 5 as a String.
> >
> >   Waiting for your earliest reply.
> >
> >   With Regards,
> >
> > b.karthikeyan.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> 



             "Worry doesn't remove the sorrow of tomorrow
                       - it removes the strength of today."

             "Live as if u were to die tomorrow,
              Learn as if u were to live forever."


-- 

Pavani Mukthipudi

Member, Technical Staff,
Sun Microsystems India Pvt. Ltd.,
6th Floor, Divyasree chambers,
Off. Langford Road, Shanti Nagar,
Bangalore-560027.

Phone: (080)2298989   Extn: 87390


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to