[jdom-interest] outputting rootElement with multiple namespac es

Norrman Per per.norrman at canovia.se
Wed Dec 25 17:09:09 PST 2002


Aah, 
the exquisite joy of XML on a late christmas night ....
You probably missed addNamespaceDeclaration.

public class XmlTest {

	public static void main(String[] args) throws Exception {
        Namespace lsb = Namespace.getNamespace("lsb",
"http://livestoryboard.com/metadata/1.0");
        Namespace dc = Namespace.getNamespace("dc",
"http://purl.org/dc/elements/1.1/");
        Namespace rdf = Namespace.getNamespace("rdf",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#");
        
        Element root = new Element("config", lsb);
        root.addNamespaceDeclaration(dc);
        root.addNamespaceDeclaration(rdf);
        
        Document doc = new Document(root);
        
        XMLOutputter out = new XMLOutputter("   ", true);
        out.output(doc, System.out);
    }
}


/pmn

-----Original Message-----
From: Robert Koberg
To: jdom-interest at jdom.org
Sent: 2002-12-24 03:26
Subject: [jdom-interest] outputting rootElement with multiple namespaces

Hi,

I am using three namespaces in an aggregated Document. I want to crerate
the
root element with all three namespaces referenced there. For example:

<lsb:config
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:lsb="http://livestoryboard.com/metadata/1.0">

Is there any way to do this (in JDOM, I know how to do it in XSL)?

I am creating a valid Document with correct namespaces, but there are
too many
namespace references (in the JDOM way that I could figure out).

best,
-Rob

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/



More information about the jdom-interest mailing list