← Prev in month ← Prev in thread

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

From
Seetha Rama Krishna <>
To
Chris Burdess <>
Date
2006-06-01T04:17:05Z
ID
<>
Thread
Re: [xml-dev] How to get Node value In a DOM Tree

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 <[email protected]> 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
← Prev in month ← Prev in thread