FW: JDOM XML Schema issue

Hi,

I need help in building XML using org.jdom.*;

Here is the XML required: 

<?xml version="1.0" encoding="UTF-8"?>
<ProductImage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ProductImage.xsd">
  <SKU>192135</SKU>
  <ImageType>Main</ImageType>
 
<ImageLocation>http://devuat.com/Assets/images_product_large/531578.jpg</Ima
geLocation>
</ProductImage>


And here is the code i am using: 

	public Element createXml(String skuNbr, String imgNbr)
	{
		Element root =  new Element("ProductImage");
	
root.addNamespaceDeclaration(Namespace.getNamespace("xsi","http://www.w3.org
/2001/XMLSchema-instance"));
		root.addNamespaceDeclaration(Namespace.getNamespace
("noNamespaceSchemaLocation","C:/badal/amazon/ProductImage.xsd"));
		
		root.addContent(getChildElement("SKU", skuNbr));
		root.addContent(getChildElement("ImageType", "Main"));
		root.addContent(getChildElement("ImageLocation",
"http://devuat.com/Assets/images_product_large/" + imgNbr +
".jpg"));
		
		return root;
	}

And here is the output I am getting: 

<?xml version="1.0" encoding="UTF-8"?>
<ProductImage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:noNamespaceSchemaLocation="C:/badal/amazon/ProductImage.xsd">
  <SKU>192135</SKU>
  <ImageType>Main</ImageType>
 
<ImageLocation>http://devuat.cvs.com/Assets/images_product_large/531578.jpg<
/ImageLocation>
</ProductImage>


The line in red is not the one I want in the xml. How can I get it to say
xsi:noNamespaceSchemaLocation="ProductImage.xsd" reather then
xmlns:noNamespaceSchemaLocation="C:/badal/amazon/ProductImage.xsd.

Please help!

Thanks,
BG

Received on Thursday, 17 July 2003 12:27:28 UTC