Hi Iain
There's a nodeIterator() method if you want to iterate through all child
nodes, text, elements, CDATA etc.
So if you modify your code to use nodeIterator() rather than
elementIterator() you should be fine.
elementIterator() just iterates through child Elements, nodeIterator()
iterates through all child Nodes. Hopefully you won't need to patch the code
to do what you need.
James
----- Original Message -----
From: "Iain Potter" <[EMAIL PROTECTED]>
To: "dom4j-user" <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 10:04 AM
Subject: [dom4j-user] Re: bug?
> A case of jumping in with both feet! Apologies for implying that this
> may have been a bug (I've done you an injustice James :-) - of course,
> the 'elementIterator()' method is only intended to return elements ;-)
> ...however, I do need an operation that returns all elements plus any
> text content for my particular application, so I'll use my solution.
>
> Cheers,
> Iain
>
> FROM: Iain Potter
> DATE: 01/09/2002 03:35:40
> SUBJECT: [dom4j-user] bug?
>
>
>
> 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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user