<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4916.2300" name=GENERATOR></HEAD>
<BODY style="MARGIN-TOP: 2px; FONT: 8pt Tahoma; MARGIN-LEFT: 2px">
<DIV><FONT size=1></FONT>I think I might have a related question, and I can't
(sorry) answer the first one. </DIV>
<DIV> </DIV>
<DIV>Can the first line in the XML output </DIV>
<DIV>"<?xml version="1.0" encoding="UTF-8"?>"</DIV>
<DIV>be avoided? I am using java.lang.String outputString(Document doc) of the
XMLOutputter class.</DIV>
<DIV>Thanks in advance, Rasmus</DIV>
<DIV> </DIV>
<DIV>Med venlig hilsen<BR>Rasmus Pedersen<BR>Ph.d./Erhvervsforsker stud.<BR>Stig
Jørgensen & Partners<BR>Lyngsø Allé 3<BR>2970
Hørsholm<BR>Telefon: 45 74 45 00<BR>Direkte: 45 74 47
26<BR>Mobil: 21 46 49 58 <BR><A
href="mailto:rasmus.pedersen@sjp.dk">rasmus.pedersen@sjp.dk</A><BR><A
href="http://www.sjp.dk">www.sjp.dk</A></DIV>
<DIV> </DIV>
<DIV>Kind regards<BR>Rasmus Pedersen<BR>Indust. Ph.d. stud.<BR>Stig Jørgensen
& Partners<BR>Lyngsoe Allé 3<BR>DK-2970
Hoersholm<BR>Phone: +45 45 74 47 00 <BR>Direct: +45 45 74 47
26<BR>Mobile: +45 21 46 49 58<BR><A
href="mailto:rasmus.pedersen@sjp.dk">rasmus.pedersen@sjp.dk</A> <BR><A
href="http://www.sjp.dk">www.sjp.dk</A><BR><BR>>>> "Butt, Vaughn A."
<vaughn.butt@nz.unisys.com> 12/09/02 05:45am >>><BR>I am trying
to get an org.jdom.Element as a string by using<BR>org.jdom.XMLoutput(Element
element,Writer writer) where the writer is a<BR>StringWriter.<BR><BR>My problem
is that the source elements with an attribute xml:lang="en-US" in<BR>it are
being streamed to my StringWriter as an element with
plain<BR>lang="en-US".<BR><BR>I checked the FAQ (<A
href="http://jdom.org/docs/faq.html)">http://jdom.org/docs/faq.html)</A> and
found that "The<BR>xml:lang and xml:space attributes are special cases that are
allowed..." but<BR>it does not say how JDOM deals with them.<BR><BR>I want to
the "xml:" included in my output.<BR><BR>Can I do this (eg by set some attribute
on XMLOutputter)?<BR><BR>If I can how is it done?<BR><BR>If I can't then please
let me know.<BR><BR>TIA (hopefully)<BR>Vaughn Butt<BR>Software
Developer<BR><BR><BR>PS. Here is the (rather ugly and slightly incomplete) code
that I want to be<BR>able to get this output from.<BR><BR>public class Migration
{<BR> public static void main(String[] args)
{<BR> org.w3c.dom.Document domDocument
=
methodThatReturnsADOMDocument();<BR><BR>
org.jdom.Document doc = new
DOMBuilder().build(domDocument);<BR><BR>
System.out.println(element2String(doc.getRootElement());<BR>
}<BR><BR> private static String element2String(Element
element) {<BR> String retVal =
null;<BR> XMLOutputter outputter = new
XMLOutputter("
",true);<BR> try
{<BR>
StringWriter sw = new
StringWriter();<BR>
outputter.output(element,sw);<BR>
retVal = sw.toString();<BR>
}<BR> catch (IOException e)
{<BR>
e.printStackTrace();<BR>
}<BR> return
retVal;<BR>
}<BR>}<BR><BR>_______________________________________________<BR>To control your
jdom-interest membership:<BR><A
href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A><BR></DIV></BODY></HTML>