[jdom-interest] Changes in Document/Element

Julián Catino jvmc at ieg.com.br
Wed Aug 2 07:40:11 PDT 2000


My apologies if my english is ugly. 

I'm Julián, an argentinian Java-C programmer living in Brazil (my
english is reand-only !).
My objective now is to study various ways to compound a set of framework
solutions to middleware envolving Oracle-SAP solutions in EIS Tier, and
I'm trying to use JDom because is very easy to undesrtand and clear to
I'm working in it a couple of weeks, so my XML is not much strong (and I 
think this is not necessary, this is the goal, isn't it?).

I'm using the getChildren(String x) method, 'cause I think is the way to
localize the Elements of
name "x", and I build a little servlet to test it. But every time
appears the Elements more times than I need.
So I decided to debug Document and Element classes to understand why I'm
doing wrong...
I change the document to test in a XML known by everybody, the famous
based in the web-app version 2.2 DTD. 
I'm using JDK 1.2.1, and JDom 1.0 Beta 3, because Beta 4 has problems in
I'm investigating this problem now.

My test code is :

	// Son los elementos que quiero analizar...

, where objXMLHead is the instace of a class persisting de XML elements.

Then, when I want to retrieve these elements, :
            if(Elem1 != null){
                Iterator itElem1 = Elem1.iterator();
                out.println("<B>Elemento 1 : " +
objXMLHead.getSzElem1Name() + "</B>");
                while (itElem1.hasNext()) {
                    Element itemElem1 = (Element) itElem1.next();
                    out.println("<BR> Servlet Name : " +
                    out.println("<BR> Servlet Class: " +

The purpose was itElem1 loop one time for each Element "servlet" founded
one-level deep. And the problem is that I have 9 loops against 3.

So I decided to debug Element.class, and then my problem is to
understand the PartialList behavior.
I realize PartialList like a subset of List containing only the elements
I need. I'm wrong ?

In the PartialList constructor, it initializes the unique protected
variable : "backingList", setted to the content (in this case, all of
the Elements one-level deep).
And then, in the "add" method, Elements are added sequentially, if match
with the name in the argument.

The result is a collection of Elements, duplicated: the first time, all
of them. The next time, only Elements of name "servlet" !
Continuing another debug night (is a paradise if you like, but if you
troubles, are nightmares)

Now, I'm installing Beta 4, thinking to fix this problem (if there is a
but before I like to know if I'm in the correct way.

Another question: Beta 4 need JRE 1.2.2_006 ?

Well, a FAQ is not a bad idea...

Cheers/Adiós muchachos/Até mais,

	Julián Catino
	Soluziona Int'l
	Sao Paulo, Brasil

More information about the jdom-interest mailing list