<!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 6.00.2900.2523" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello folks,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Just to get it over with, I'm an XML newbie so keep
the flame throwers away for a while please.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Today I upgraded from JDOM beta 9 to the current
release. As they say, better late than never :) My code needed very few changes
in order to compile, the constructor for XMLOutputter had changed but that was
easy to fix. However when running the code, see below, a small incompatibility
surfaced. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>with beta 9 the code below produced the
following</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?xml version="1.0"
encoding="UTF-8"?><BR><message><BR>
<request><BR>
<onlyreturnoutdata>0</onlyreturnoutdata><BR>
</request><BR></message></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>however with the current release I got</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?xml version="1.0"
encoding="UTF-8"?><BR><message xmlns:=""><BR>
<request><BR>
<onlyreturnoutdata>0</onlyreturnoutdata><BR>
</request><BR></message></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>as you can see the line containing the
<message> tag suddenly includes the attribute 'xmlns:=""'</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My question is this, how do I get rid of this xmlns
attribute so that the message looks exactly like it did in beta 9?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Jan-Olof Hendig</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>/* --------------------- */</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>public class TestCase
{<BR> <BR> protected static Document document;<BR> protected
static Element rootElement;<BR> <BR> public static void main(String[]
args) {<BR> rootElement = new
Element("message");<BR> Element requestElement = new
Element("request");<BR> Element onlyReturnOutDataElement = new
Element("onlyreturnoutdata");<BR> onlyReturnOutDataElement.addContent("0");<BR> <BR> requestElement.addContent(onlyReturnOutDataElement);<BR> rootElement.addContent(requestElement);<BR> document
= new Document(rootElement);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2> System.out.println(documentToString(document,
true));<BR> }<BR> <BR> <BR> public static String
documentToString(Document doc, boolean fIndent) {<BR> JDOMSource
domSource = new JDOMSource(doc);<BR> StringWriter stringWriter = new
StringWriter();<BR> StreamResult result = new
StreamResult(stringWriter);<BR>
<BR> TransformerFactory tFactory =
TransformerFactory.newInstance();<BR> try
{<BR> Transformer transformer =
tFactory.newTransformer();<BR> if (fIndent)
{<BR>
transformer.setOutputProperty(OutputKeys.INDENT,
"yes");<BR> transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"3");<BR> }<BR> else<BR>
transformer.setOutputProperty(OutputKeys.INDENT,
"no");<BR> transformer.transform(domSource,
result); <BR> }
<BR> catch (Exception e)
{<BR> System.out.println(e); <BR> }<BR> return
stringWriter.toString();<BR> }<BR>}<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>