[jdom-interest] Namespace declaration

Sachin Keshavan Sachin.Keshavan at symphserv.com
Thu Aug 8 01:48:59 PDT 2002


Hello all,

I am using the following code snippet to create a Namespace for validating
the xml file.
Element pDetails = new
Element("Personal_Details","xsi","http://www.w3.org/2001/XMLSchema-instance"
);
Attribute schemaVal = new Attribute("noNamespaceSchemaLocation",
"C:\\SampleProgs\\PersonalDetailsSchema.xsd",pDetails.getNamespace());

This generates the xml file in the following format
<xsi:Personal_Details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\SampleProgs\PersonalDetailsSchema.xsd"/>

How ever my XML editor declares this XML document as an invalid one (I use
XMLSpy). Its says the Root Element is not defined in the DTD/Schema
document. 

The XML editor generates a sample XML file based on the Schema. Which is:
<Personal_Details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\SampleProgs\PersonalDetailsSchema.xsd">

This file is valid (XML Editor says so). The only differenece between both
the files is the "xsi" tag which comes in the Personal_Details tag. 

Is there any other way of setting the namespace attributes, so that XMLSpy
identifies it as a correct file.

Thanks in advance,
Sachin.



More information about the jdom-interest mailing list