Hi
If you have the same problem as I have and want to get your XML code as a
String (if your logging system only handles String logging, like mine, for
example) I made up a little trick that looks like this.
(newDoc is a Document)
OutputFormat outFormat = OutputFormat.createPrettyPrint();
outFormat.setEncoding("ISO-8859-1");
ByteArrayOutputStream bao = new ByteArrayOutputStream();
XMLWriter out = new XMLWriter(bao, outFormat);
out.write(newDoc);
String s = bao.toString();
System.out.println("OUT: " + s);
Cheers Christian
P.s. There might be a easier way to get the Document nicely printed into a
String but I could not find it.... D.s.
> -----Ursprungligt meddelande-----
> Fr�n: Joshua Paech [mailto:[EMAIL PROTECTED]]
> Skickat: den 24 april 2002 03:17
> Till: [EMAIL PROTECTED]
> �mne: [dom4j-user] Formatting of 'asXML()' result
>
>
> I want to print out particular dom4j Elements containing a
> few attributes
> plus some text. If I do an element.asXML(), the String
> returned is all one
> line. Is it possible to get newlines inserted between each attribute?
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user