to change the contens of the element you have to work with the elements and not on the document. Se the documentation for this: --- setStripWhitespaceText(boolean) - Method in class org.dom4j.io.SAXReader Sets whether whitespace between element start and end tags should be ignored. setStripWhitespaceText(boolean) - Method in class org.dom4j.io.SAXContentHandler Sets whether whitespace between element start and end tags should be ignored. ---
If a io class starts messing with the contens of the io then there is something wrong in the design. /Christian > -----Ursprungligt meddelande----- > Från: Stephen C. Upton [mailto:[EMAIL PROTECTED]] > Skickat: den 7 oktober 2002 21:39 > Till: dom4j > Ämne: [dom4j-user] stripWhiteSpaceText > > > Is there a method to strip whitespace within an element's text while > reading in? > For example, I'd like to strip out the whitespace before and after > "NoSensor" in the snippet below. I'm doing this for XPath > reasons, i.e., > I'd like to have //Sensor[name="NoSensor"] instead of > //Sensor[normalizespace(name)="NoSensor"] or //Sensor[name=" NoSensor > "]. > <Sensor> > <name> NoSensor </name> > <range> 0.0 </range> > <frameTime> 10000.0 </frameTime> > <timeout> 2.0 </timeout> > </Sensor> > > I tried setStripWhitespaceText for the SAXReader, but this > doesn't do it > (I noticed in the archives there's a email concerning this, but looks > like strips the whitespace outside of the elements or between > elements, > but not within. > > thanx > steve > > > > > ------------------------------------------------------- > 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