[jdom-interest] A utility Element subclass and a request for API
jhunter at servlets.com
Wed Mar 20 23:54:16 PST 2002
> Recently I downloaded and used JDOM 1b8 for what I imagine to be a common
> use, persisting some data in XML form. The change from using the W3 DOM API
> was remarkable, thanks guys! Constructs like:
> element.addContent(new Element("foo").setAttribute("bar", "true"));
> made what had been a tedious and error prone process, fairly painless.
Glad to hear it.
> However, I found myself continually having to convert Java primitive types
> when using setAttribute(String, String, Namespace).
Have you thought about just using the ""+ trick?
setAttribute("somefloat", "" + yourfloat);
setAttribute("somebool", "" + true);
It's not too bad, and probably nicer than making Element larger. One
goal of JDOM is simplicity.
More information about the jdom-interest