[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to get Node value In a DOM Tree

  • To: Chris Burdess <dog@b...>, xml-dev@l...
  • Subject: Re: How to get Node value In a DOM Tree
  • From: Seetha Rama Krishna <ram_kurra@y...>
  • Date: Thu, 1 Jun 2006 08:14:06 +0100 (BST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2btwNr/KlfGoDqz27JivoyAuIcP8t9EYBZ0m2BBJfCNfrC+Z/o76c5fRd9fEOZ6BAdG4YvvtO5T4SsVwm/EtbRsVIM0wkTTtxDYmkwm8+nJCs/RiLIeqa1KodsoDRmcOz/Yz0hKT3/v+adZwkM0uyPMkwaeIHO2AAUpRtR2McqI= ;
  • In-reply-to: <DF5D9A34-FEF1-4DED-805F-4B891AE0C461@b...>

dom get text

Hi Chris,
        I had found where exactly the problem is .The element Node will take only null values.
         I have to create a DOM Tree  in the following format.

    <Application>
        <application_id>   1 </application_id>
        <application_name>krish    </application_name>
        < description>   This is test </description>
  </Application>

          The values that I am  placing in the following tags tage<application_id>,<application_name> and <description>  are from database.

My Code is


Element root = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();

root = document.createElement(Root_Element);
document.appendChild(root);


Element applicationElement =document.createElement(Application);
root.appendChild(applicationElement);


Element applicationIdElement =document.createElement(application_id);
applicationIdElement.setNodeValue("1");
appliationElement.appendChild(applicationElement);
 
        Now let us suppose that  I had created Text Node

TextNode t  =  applicationElement.createTextNode(application_id);
applicationElement.appendChild(t);

           Now The value which I am getting from database I am not  sure that it is always be a String , Some times , it may be
int,bigInt,String,Clob.
                In this situation How can I create DOM Tree??

               To obtain the above xml structure, Whether I have to create text Node's under application??  Plz guide me.


Regards,
Ramu
Chris Burdess <dog@b...> wrote:
Seetha Rama Krishna wrote:
> Thanks for u r reply. I used getNodeType() to get the Node
> Type . It is giving 1. i.e it Element Node.
> Then How can I retrieve the value of Element Node.

You didn't read what I said.
--
犬 Chris Burdess
"They that can give up essential liberty to obtain a little safety
deserve neither liberty nor safety." - Benjamin Franklin







regards,
ramu


Yahoo! India Answers: Share what you know. Learn something new http://us.rd.yahoo.com/mail/in/mailanswersshare/*http://in.answers.yahoo.com/
Send free SMS to your Friends on Mobile from your Yahoo! Messenger http://us.rd.yahoo.com/mail/in/freesms/*http://messenger.yahoo.com/download.php

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.