[jdom-interest] Weird namespace attribute when using JAXP transformer

Per Norrman per.norrman at austers.se
Sat Oct 23 04:04:10 PDT 2004


Hi,

Not sure what's happening, but when I use saxon I do not get the
namespace declaration.

/pmn

Oliver Koell wrote:
> Hi all,
> 
> I want to serialize my JDOM documents using JDOMSource and a JAXP 
> identity transformer (the variant without stylesheet) because i need 
> HTML output (method = "html). Here is the output for a very simple 
> document:
> 
>   <?xml version="1.0" encoding="UTF-8"?>
>   <html xmlns:=""></html>
> 
> I'm wondering, where the xmlns:="" attribute on the root element comes 
> from - i do not get this with an equivalent W3C document and DOMSource.
> 
> My code looks like this:
> 
>   Document doc = new Document(new Element("html"));
> 
>   TransformerFactory fact = TransformerFactory.newInstance();
>   Transformer tf = fact.newTransformer();
>   tf.setOutputProperty(OutputKeys.METHOD, "html");
> 
>   Source source = new JDOMSource(doc);
>   Result result = new StreamResult(System.out);
>   tf.transform(source, result);
> 
> (note, that the "html" output method is not actually relevant. I get the 
> same result for "xml" output).
> 
> Does anybody have some insight where the namespace attribute is coming 
> from and how to get rid of it? This would be very much appreciated.
> 
> Another question: are there any alternatives for producing HTML from 
> JDOM documents?
> 
> Regards, Oliver
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 



More information about the jdom-interest mailing list