Edwin, Is that why I have to manually escape attribute text? Will this be fixed at some point? --Evan
Tom Doman wrote: > Yes, generating entity references is certainly something I'd prefer to do. > It'll save a LOT of size on my document not to mention readability. > References to other definitions and types is a part of pretty much every > RDF\OWL definition, usually several times per definition. > > Anyway, thank you very much Edwin for the suggestion. I tried it and it > works as you expected. I went ahead and left the escapeText property at it's > default since any time I set text, I would want the escapement to occur. > > Regards, > Tom Doman > Novell Inc. > > >>>> "Edwin Dankert" <[EMAIL PROTECTED]> 9/29/2006 3:00 AM >>> >>>> > The philosophy behind this is that entities are used to substitute text > inside a document, mainly to support human entry of the text, however > when generating the document programmatically, the developer can > use the programming language to facilitate him in creating the document > so there should not be a need for these entities and therefor dom4j's > entity support for serialization is not very good. > > So, my recommendation would be not to try to generate Entities using > dom4j, however if you really need to ... > > For elements you can set the 'escapeText' property as a work-around, > this property however does not seem to work for attributes. > > So instead, you will have to override the escapeAttributeEntities method. > > I haven't tested the following but it should work: > > public class EscapedXMLWriter extends XMLWriter { > protected String escapeAttributeEntities(String text) { > return text; > } > } > > Regards, > Edwin > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user