Bugs item #1180791, was opened at 2005-04-11 17:01
Message generated for change (Comment added) made by maartenc
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1180791&group_id=16035
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Fromm (tfromm)
Assigned to: Maarten Coene (maartenc)
Summary: trimtext and newline problem in 1.5.x
Initial Comment:
In 1.4 modifyes the trimText(true) option for the OutputFormat
not only the values between tags but inside the tags.
e.g. source: <foo> bar </foo> result: <foo>bar</foo>
So i decided to set trimText(false). But i wanted to have newlines
between the tags and so i used newlines(true). Everything fine.
In 1.5.2 is the behaviour a littlebit different. trimText is still false
and newlines is true but instead of:
<foo>
<bar/>
</foo>
i get:
<foo>
<bar/>
</foo>
Simply too much newlines. if i disable newlines, i get:
<foo> <bar/></foo>
Ok, newline=true appends newlines after the tags without
removing possible older existing newline tags. This would be not
problem, if trimText=true never touches the value of tags, only
removing whitespaces and similar stuff between tags.
source:
<Test> <foo> bar </foo> </Test>
my expected result of trimtext:
<Test><foo> bar </foo></Test>
Of course dont change the current default behaviour, just add an
option, that allows the user to decide, if he wants also the content
of tags should be trimmed.
----------------------------------------------------------------------
>Comment By: Maarten Coene (maartenc)
Date: 2005-05-05 15:31
Message:
Logged In: YES
user_id=178745
It should be fixed in CVS now, could you try again with the
latest sources from the DOM4J_1_X_BRANCH branch?
thanks
Maarten
----------------------------------------------------------------------
Comment By: Thomas Fromm (tfromm)
Date: 2005-04-26 17:10
Message:
Logged In: YES
user_id=79402
Its possible, that you can fix trimText for 1.5.x in the same way as
implemented in 1.6, because i'am not able to update to 1.6 (jaxen xpath
problems and dom4j need stuff from the actual jaxen).
----------------------------------------------------------------------
Comment By: Thomas Fromm (tfromm)
Date: 2005-04-21 08:51
Message:
Logged In: YES
user_id=79402
String xml="<?xml
version=\1.0\?><root><foo>bar</foo></root>";
SAXReader reader=new SAXReader();
Document doc=reader.read(new StringReader(xml));
// of with newlines
OutputFormat format = new OutputFormat();
format.setNewlines(true);
// first time
StringWriter writer=new StringWriter();
XMLWriter xmlwriter=new XMLWriter(writer, format);
xmlwriter.write(doc);
System.out.println(writer.toString());
// 2nd time
doc=reader.read(new StringReader(writer.toString()));
writer=new StringWriter();
xmlwriter=new XMLWriter(writer, format);
xmlwriter.write(doc);
System.out.println(writer.toString());
----------------------------------------------------------------------
Comment By: Maarten Coene (maartenc)
Date: 2005-04-20 21:05
Message:
Logged In: YES
user_id=178745
Could you given me some example code I can execute that
illustrates your problem?
thanks,
Maarten
----------------------------------------------------------------------
Comment By: Thomas Fromm (tfromm)
Date: 2005-04-13 11:34
Message:
Logged In: YES
user_id=79402
Sorry, had wrong test results. It happens with writers and with streams.
If i read pretty document and have not "trimtext" enabled at
outputformat, then the result are too much new lines.
----------------------------------------------------------------------
Comment By: Thomas Fromm (tfromm)
Date: 2005-04-13 11:28
Message:
Logged In: YES
user_id=79402
It seems, that the multiple newlines at storing only happens, when i
load a pretty printed document and store it into a outputstream.
Using a Writer seems to work.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1180791&group_id=16035
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
dom4j-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev