W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2003

FW: JDOM XML Schema issue

From: Garg, Badal <BGarg@cvs.com>
Date: Wed, 30 Jul 2003 16:51:25 -0600
Message-Id: <5.1.0.14.1.20030730165119.02ed3778@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>






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 Wednesday, 30 July 2003 18:55:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:00 UTC