OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] How to get Node value In a DOM Tree

[ Lists Home | Date Index | Thread Index ]
  • To: Chris Burdess <dog@bluezoo.org>
  • Subject: Re: [xml-dev] How to get Node value In a DOM Tree
  • From: Seetha Rama Krishna <ram_kurra@yahoo.co.in>
  • Date: Thu, 1 Jun 2006 05:17:05 +0100 (BST)
  • Cc: xml-dev@lists.xml.org
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=CGT5fErvLLtLypEAJG7ck/A4TW5hgaSPtD6Lylswl7SF1IFFjJNIhvvHB6S7V2gJCECrBfToGwQW1jnjfMs9pvSMMUHpQf+ToNdNcWyPf+0FSAYMpt3iosBE49/4KwmB3BN5qIA1JeOQVagw68rsniq1z+kwgBkRti0MSSAis0Q= ;
  • In-reply-to: <DF5D9A34-FEF1-4DED-805F-4B891AE0C461@bluezoo.org>


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@bluezoo.org> 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 Click here
Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS