W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

FW: JDOM XML Schema issue

From: Garg, Badal <BGarg@cvs.com>
Date: Thu, 17 Jul 2003 12:25:24 -0400
Message-ID: <DE0F6CC0BB981646AFBA712DCD1D4B78F2A6ED@cvsex002>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, "'www-xml-schema-comments@w3.org'" <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 Thursday, 17 July 2003 12:27:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:39 GMT