[XOM-interest] Problem creating the right namespace.

Christian-Josef Schrattenthaler hotline at software-agentur.com
Wed Feb 25 04:05:11 EST 2009


Hi!

 

I have to use xml files for a little Java project. These files are
generated over the Java application itself, but I have to use an
external xml schema.

 

The root element must look like:

 

<rootelement xmlns=http://... xmlns:xsi=http://...
xsi:schemaLocation="http://...">

 

I did:

 

Element xmlRoot = new Element("onlv",
"http://www.oenorm.at/schema/A2063/2009-01-15");

xmlRoot.addNamespaceDeclaration("xsi",
"http://www.w3.org/2001/XMLSchema-instance");

 

But now I don't know how to add 'xsi:schemaLocation="http://..."', and I
have an empty (xmlns="") attribute on each child element I add to the
root element.

 

This generates an error, while validating the xml file against the
external xml schema.

 

I tried also to add a second parameter "" while creating the element,
but this doesn't work.

 

I googled for the problem, but I didn't find anything useful

 

Kind greetings,

Christian.



More information about the XOM-interest mailing list