SV: [jdom-interest] problem xmlns namespace

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


Hi,

Try this:

	Element root = new Element("document");
	Namespace xf =
		Namespace.getNamespace(
			"xf",
			"http://apache.org/cocoon/xmlform/1.0");
	root.addNamespaceDeclaration(xf);
	root.addContent(new Element("form", xf).addContent(new
Element("group", xf)));

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


/pmn

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




Hello,

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="http://apache.org/cocoon/xmlform/1.0">
  <xf:form view="deathcertificate/result.xml">
        <xf:group class="maintitle">
         <xf:caption>Overlijdensakte aanvragen</xf:caption>
        </xf:group>



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


Element rootElement = new Element("document", "xf",
"http://apache.org/cocoon/xmlform/1.0");
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="http://apache.org/cocoon/xmlform/1.0 attribute everywhere.



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

Thnx

Twan




More information about the jdom-interest mailing list