Se documentation for createPrettyPrint: --- public static OutputFormat createPrettyPrint() A static helper method to create the default pretty printing format. This format consists of an indent of 2 spaces, newlines after each element and all other whitespace trimmed, and XMTML is false. ---
This is doing exactly how it should be doing. If you want to strip your element text of whitespace I would suggest that you either do a walker that moves throw your document and removes the whitespace. Or create your own implementation of the node that should ignore whitespace (i.e. element). Cheers Christian > -----Ursprungligt meddelande----- > Från: Stephen C. Upton [mailto:[EMAIL PROTECTED]] > Skickat: den 8 oktober 2002 03:37 > Till: dom4j > Ämne: [dom4j-user] Bug or feature? > > > I read in the first snippet (identified by INPUT below) using > SAXReader > (both with setStripWhitespaceText to true and false). I then write out > using XMLWriter with createPrettyPrint OutputFormat. I get the snippet > identified below OUTPUT. Seems that the text of the elements that have > newlines embedded in the element text get deleted along with the > newlines. Obviously not what I want (well, maybe not obvious ;-) > > Suggestions? > > thanx > steve > p.s. this was my workaround to an earlier question about stripping > whitespace within an element. > ********* > INPUT > *********** > <agent> > <name> blueDude </name> > <side> BLUE </side> > <sensors> > BlueSensor > </sensors> > <commDevices> > Blue1 > </commDevices> > <movement> > BlueMovement > </movement> > <decisions> > viewSensors > movement > </decisions> > <movementComponents> > BlueMovementComponents > </movementComponents> > <commInterval> 20.0 </commInterval> > <sentiment>BlueSentiment</sentiment> > <refData>BlueReference</refData> > </agent> > ************ > OUTPUT > ********** > <agent> > <name>blueDude</name> > <side>BLUE</side> > <sensors/> > <commDevices/> > <movement/> > <decisions/> > <movementComponents/> > <commInterval>20.0</commInterval> > <sentiment>BlueSentiment</sentiment> > <refData>BlueReference</refData> > </agent> > *********** > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user