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

Re: FW: JDOM XML Schema issue

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 17 Jul 2003 17:40:52 +0100
Message-ID: <195886702570.20030717174052@jenitennison.com>
To: "Garg, Badal" <BGarg@cvs.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hi Badal,

[Removed cross-post to www-xml-schema-comments@w3.org since that
mailing list is for comments on the XML Schema standard, and this
isn't a comment on the XML Schema standard. Actually, this message
hasn't really got anything to do with XML Schema at all...]

> 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.

The code you're using to create this is:

  root.addNamespaceDeclaration(Namespace.getNamespace
    ("noNamespaceSchemaLocation","C:/badal/amazon/ProductImage.xsd"));

Since you're saying "add a namespace declaration", the code is
adding a namespace declaration (an xmlns:prefix="URI" attribute).

If you want to add an attribute called xsi:noNamespaceSchemaLocation,
where 'xsi' is associated with the namespace
'http://www.w3.org/2001/XMLSchema-instance' then you need to use the
.setAttribute() method:

  root.setAttribute("noNamespaceSchemaLocation",
                    "C:/badal/amazon/ProductImage.xsd",
                    Namespace.getNamespace("xsi",
                      "http://www.w3.org/2001/XMLSchema-instance"))

The first argument is the name of the attribute; the second argument
is its value; the third argument is the namespace that it belongs to.
                      
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 17 July 2003 12:40:58 GMT

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