Hi,

I experienced what I think is a bug in the framework.  When a 
DefaultText is added to a new DefaultElement and then the 
elementIterator() method is called, the returned Iterator is empty.  Is 
this behaviour expected or is it a bug?  I have written some sample code 
(below) to illustrate what I mean.


QName name = new QName("Element");
DefaultElement element = new DefaultElement(name);

DefaultText text = new DefaultText("Text");
element.add(text);

// This does not return the text...
Iterator it = element.elementIterator();

while(it.hasNext())
{
      System.out.println("Child: " + it.next());
}

// ...this does
System.out.println(element.getText());


I can make the Iterator return the DefaultText by modifying the 
elementIterator() method in the DefaultElement class.  The type-checking 
of the content variable is modified to check for 'Node' instead of 
'Element'.  I can simply use my modified code, but I would prefer to 
have an 'official' build if this is a bug!

TIA,

Iain

-- 

Iain Potter
Senior Software Engineer
PrismTech Limited

www.prismtechnologies.com


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to