Maybe you should try something like this instead: <example> Namespace html = Namespace.get( "html","http://www.w3.org/TR/REC-html40"); Namespace ss = Namespace.get( "ss", "urn:schemas-microsoft-com:office:spreadsheet");
Element data = DocumentHelper.createElement( QName.get( "Data", ss)); Element b = DocumentHelper.createElement( QName.get( "B", html)); Element font = DocumentHelper.createElement( QName.get( "Font", html)); font.addAttribute( QName.get( "Face", html), "Tahoma"); font.addAttribute( QName.get( "Size", html), "8"); font.addAttribute( QName.get( "Color", html), "000000"); font.setText( "\n\t\tAuthor:\n"); b.add( font); data.add( DocumentHelper.createText( "\n")); data.add( b); data.add( DocumentHelper.createText( "\n")); </example> When you don't specify in your outputformat to trim the text, all text content should stay as it is. OutputFormat.setTrimText( false); (default behavior) You should always be able to solve the problem using the solution above, however if you're a little bit lazy (and you might argue that this markup isn't part of the core of your application) you can use the following as well: <donttryathome> Namespace ss = Namespace.get( "ss", "urn:schemas-microsoft-com:office:spreadsheet"); Element data = DocumentHelper.createElement( QName.get( "Data", ss)); data.add( DocumentHelper.createText( "\n<html:B xmlns:html=\"http://www.w3.org/TR/REC-html40\">"+ "<html:Font html:Face=\"Tahoma\" html:Size=\"8\" html:Color=\"000000\">\n"+ "\t\tAuthor:\n"+ "</html:Font></html:B>\n")); document.add( data); </donttryathome> You have to use the setEscapeText method to make sure the text isn't escaped ('<' converted to '<') by the XMLWriter. (warning: this escapes all text) XMLWriter.setEscapeText( false); Regards, Edwin -- http://www.edankert.com/ ------------------------------------------------------- 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