SV: [jdom-interest] problem xmlns namespace

Per Norrman pernorrman at
Mon Nov 17 06:32:14 PST 2003


Try this:

	Element root = new Element("document");
	Namespace xf =
	root.addContent(new Element("form", xf).addContent(new
Element("group", xf)));

	new XMLOutputter("  ", true).output(root, System.out);


-----Ursprungligt meddelande-----
Från: jdom-interest-admin at [mailto:jdom-interest-admin at]
För Twan Munster
Skickat: den 17 november 2003 14:47
Till: jdom-interest at
Ämne: [jdom-interest] problem xmlns namespace


I have to generate a piece of xml, which is in the folowing format:
this is for generating xml-forms for cocoon. 

<?xml version="1.0" encoding="UTF-8"?>
<document xmlns:xf="">
  <xf:form view="deathcertificate/result.xml">
        <xf:group class="maintitle">
         <xf:caption>Overlijdensakte aanvragen</xf:caption>

My problem is getting the document xmlns line to work. When I use  

Element rootElement = new Element("document", "xf",
a xf: is placed before the document tag and I don't want that. 

I also want as you can see a xf: placed before every other tag, without
getting the 
xmlns:xf=" attribute everywhere.

is there a way of doing this? I would be very grateful



More information about the jdom-interest mailing list