Bugs item #593147, was opened at 2002-08-09 10:36
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=593147&group_id=16035

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: bug in XMLWriter.writeElementContent()

Initial Comment:
If an element has more than 2 text nodes, only the 1st 
and last nodes will get written.

The StringBuffer is recreated with only the contents of 
the first node each time the else path is chosen.

for ( int i = 0, size = element.nodeCount(); i < size; i++ ) 
{
                Node node = element.node(i);
                if ( node instanceof Text ) {
                    if ( lastTextNode == null ) {
                        lastTextNode = (Text) node;
                    }
                    else {
                        buffer = new StringBuffer(  
lastTextNode.getText() ); 
                        buffer.append( ((Text) node).getText() );
                    }
                }
.
.
.
}

Noticed the problem because SAXReader was creating 
separate text nodes within an element for all entities 
(&amp; , &gt; , &lt; , etc...)

Work around: I use setMergeAdjacentText(true) on the 
SAXReader before reading in an XML document.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=593147&group_id=16035


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to