[XOM-interest] Defining schema location

Daniel Garrido djbgarrido at gmail.com
Mon Mar 10 14:11:09 EDT 2008


Hi!

I'd like to know how to create the root element with the following definitions:

<cns:Constraints xmlns:cns="http://www.example.org/Constraints"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.example.org/Constraints
../../../Structures/Constraints/Constraints.xsd ">
...
</cns:Constraints>

I've already been able to write a xml with all namespace definitions,
but not with the schemaLocation. Nextly i'll post the code i'm using:

                String namespace = "http://www.example.org/Constraints";
		String prefix = "cns:";
		Element root = new Element(prefix + "Constraints", namespace);
		root.addNamespaceDeclaration("xsi",
"http://www.w3.org/2001/XMLSchema-instance");

Thanks in advance for your time,
Daniel Garrido


More information about the XOM-interest mailing list