Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

RE: [jdom-interest] how to create an element here

Mark Hale

2005-07-28


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@(protected)
[mailto:jdom-interest-bounces@(protected)
Lakshminarayana
Sent: Thursday, July 28, 2005 8:52 AM
To: jdom-interest@(protected)
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


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.