[jdom-interest] Newbie question: ResultSetBuilder

Jason Hunter jhunter at servlets.com
Wed Sep 11 15:33:27 PDT 2002


> I then discoverd the rest of JDOM, and realised that it
> didn't have to be as hard a job as it had been until that point.

Cool, you found the JDOM religion.  :-)

> Firstly, I needed to get the results of several queries and store them in a
> single XML file. I found myself doing the slightly silly looking:
> 
>     [Element].addContent(builder.build().getRootElement());
> 
> Wouldn't it be more sensible for the builders to build root elements, rather
> than whole documents, or (more probable) am I missing something?

There's not much difference between the two options.  Returning a
Document seems to be more elegant because then it's a self-contained
unit, and most people probably aren't doing the combining like you are.

> Secondly, I needed to be able to differentiate nulls from empty strings, so
> I have added a method to resultSetBuilder called setNullAttrib. It takes two
> strings, one is an attribute name and the other is a value - I use "Null"
> and "Yes". If it is called, it gives that attribute to fields that were null
> (ie <fieldname Null="Yes" /> rather than just <fieldname  />. Do other
> people think this is a good idea? Where do I submit my changes for inclusion
> in the main distribution?

Interesting idea.  I might make it lowercase "null" since that seems
more standard for built-in attributes and "true" or "false" since that's
more common too.  But I really like the idea.  Send code to the list or,
if it's large, to me.

-jh-





More information about the jdom-interest mailing list