[jdom-interest] how to create an element here

Mark Hale Mark at beforethecall.com
Thu Jul 28 09:27:50 PDT 2005


Hi Narahari.
 
I think what you want to do is create an individual Element.
 
    Element hourdata = new Element("hourdata");
        hourdata.setAttribute("hour","1400");
        hourdata.setAttribute("curtemp","88");
        ...
 
You can then add this to a document later:
 
    Document d = ... your existing document;
        d.getRootElement().addContent(hourdata);
 
If you reuse hourdata, you can clone it:
 
        d.getRootElement().addContent((Element) hourdata.clone());
 
Mark
 

________________________________

From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org] On Behalf Of Narahari
Lakshminarayana
Sent: Thursday, July 28, 2005 8:52 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] how to create an element here


Hello Folks,
 
I want to create just one element with this data ?  How do I do this ?
 
<hourdata hour="140000" curtemp="88" dewpointtemp="72" windspeed="4"
winddir="290" weather_conditions="" relative_humidity="60"
apparent_temp="94"
icon_link="http://www.nws.noaa.gov/weather/images/fcicons/tsra.jpg" />

 
-Narahari




More information about the jdom-interest mailing list