[jdom-interest] how to get XmlOutputter to accept xmlns in an attribute.

Michael E. Ross mross at tgf.tc.faa.gov
Tue Feb 20 12:59:48 PST 2007


Hello,
I've been through the search and manuals I have available. From what I have
read what I'm
asking seems to not be allowed. Yet it seems neccesary for an application
I'm working on.
I'm using XmlOutputter to generate xml files for GoogleEarth. They will be
updated every
60 seconds so no hand editing is possible. I need to get this line in my xml
file;

<kml xmlns="http://earth.google.com/kml/2.0">


The java code I have looks like this;

Element kml = new Element("kml");
Attribute xmlns = new Attribute("xmlns","http://earth.google.com/kml/2.1");
kml.setAttribute(xmlns);

This of course throws a org.jdom.IllegalNameException.

I have tried various uses of the Namespace field but have not found a way to
do it.
Any ideas? I want to use XmlOutputter as it makes codeing much cleaner.
Thanks,
Mike



More information about the jdom-interest mailing list