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

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Feb 20 13:32:30 PST 2007

Element kml = new Element("kml", Namespace.getNamespace("http://earth.google.com/kml/2.1"));


"Michael E. Ross" writes:

> 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
> _______________________________________________
> 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