Hi; For those that hit this problem, here is the solution I came up with. I made a copy of XMLWriter and made that my own class. I then added Node as a var passed to escapeElementEntities which then lets me escape the text based on the node it is in.
Thanks - dave -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Thielen Sent: Sunday, December 12, 2004 8:35 PM To: 'Maarten Coene' Cc: [EMAIL PROTECTED] Subject: RE: [dom4j-user] Need to set xml as Element text Hi; Thank you - this sort-of works. By sort-of, I mean it works great for not converting characters. The problem is, I only want it to do this inside nodes of type <ss:Data>. But I have no way of knowing what node I am in so I have to do this for either all or no nodes. Is there any way around this? It would be nice if a node could be marked as literal and in that case no translation occurred on output. Thanks - dave -----Original Message----- From: Maarten Coene [mailto:[EMAIL PROTECTED] Sent: Thursday, December 09, 2004 4:42 AM To: David Thielen Cc: [EMAIL PROTECTED] Subject: Re: [dom4j-user] Need to set xml as Element text Hi David, I think you should subclass org.dom4j.io.XMLWriter and override the escapeElementEntities(String text) method to not escape the <> characters and to convert your '\n' to the appropriate &#xxx Take a look at the current implementation of that method: http://www.dom4j.org/xref/org/dom4j/io/XMLWriter.html#1359 regards, Maarten David Thielen wrote: > Hi; > > Ok, this is a very weird request. And I know it violates how xml is > supposed to work. But it's a requirement of the SpreadsheetML format > that Microsoft is using. > > This format has: > > <Data>blah blah blah</Data> > > Where blah blah blah is the contents of a cell in the spreadsheet. > Here is the weirdness. Let's say all of the text is bold. Then the xml is: > > <Data><B>blah blah blah</B></Data> > > But if it is written as: > > <Data> > > <B>blah blah blah</B> > > </Data> > > Then the cell contents are " \n<B>blah blah blah</B>\n " > > How can I write this using dom4j? I figure I can create a separate > rendering of the cell text - but I then have to be able to write it > where the <> does not get converted to <>. > > Again, I did not design this - Microsoft did. I just have to live with it. > > ??? - thanks - dave > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user