Create an attribute on the top element where you want to preserve the whitespace called xml:space="preserve" and it should not strip out whitespaces in the children text nodes. This is a standard in XML and should preseve the whitespace, but I don't know if Excel will accept it or not. I know that IE ignores the actual value of the xml:space, but complains if you try and define xmlns:xml. So I am not sure how Excel will handle it. But, the XML output should have the layout that you want when you set the text. Let me know if you have any problems. For more info on xml:space see section 2.10 on White Space Handling at http://www.w3.org/TR/REC-xml/ . It does say "MAY" for support and not "REQUIRED" so your mileage may vary.
An example of the xml might look like: <top> <row> <col> This is a test!</col> </row> <row> <col xml:space='preserve' > <a><b> This is embedded!</b></a> <a><b> This is space=preserve too!</b></a> </col> </row> <row> <col> This is a test!</col> </row>" </top> Best Wishes, Dave David Thielen wrote: > Hi; > > > > I need to keep the text for an element exactly as is when writing the > xml file. (This is for a SpreadsheetML file for Excel and it defines how > this works.) So any spaces, cr/lf, etc must be preserved. > > > > Also, any <>&’” must be left literally in the text. (I did not define > this spec!!!). > > > > At present I have my own writer derived from XMLWriter. But I was > wondering if 1.6.1 now supports this? > > > > Thanks - dave > > > > > > David Thielen > > 303-499-2544 > > www.windwardreports.com <http://www.windwardreports.com> > > > -- +------------------------------------------------------------+ | David Lucas mailto: ddlucas @ lse.com | | Lucas Software Engineering, Inc. (740) 964-6248 Voice | | Unix,Java,C++,CORBA,XML,EJB (614) 668-4020 Mobile | | Middleware,Frameworks (888) 866-4728 Fax/Msg | +------------------------------------------------------------+ | GPS Location: 40.0150 deg Lat, -82.6378 deg Long | | IMHC: "Jesus Christ is the way, the truth, and the life." | | IMHC: "I know where I am; I know where I'm going." <>< | +------------------------------------------------------------+ Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt IMHO="in my humble opinion" IMHC="in my humble conviction" All trademarks above are those of their respective owners. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user