You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Sibon Barman <si...@ss8networks.com> on 2000/10/24 23:52:29 UTC

xerces and jdom-beta5 question

Hi all,
I am trying to generate a document with root element as follows:
<document xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
	    xsi:noNamespaceSchemaLocation='slp.xsd'>
</document>
I declare my root element in the above way so that I can use Xerces for
later parsing and validating with schema --- unless the Xerces gurus know a
different way of specifying the schema location.

I use the following piece of code for generating the above (using jdom-beta5
API):
new Element("document")
            .addAttribute(new Attribute("xsi",
            "http://www.w3.org/1999/XMLSchema-instance",

Namespace.getNamespace("http://www.w3.org/1999/XMLSchema-instance")))
            .addAttribute(new Attribute("noNamespaceSchemaLocation",
            "slp.xsd", Namespace.getNamespace("xsi", "slp.xsd")));

and what I get out of this code snippet is:

<document xmlns="http://www.w3.org/1999/XMLSchema-instance"
	    xsi="http://www.w3.org/1999/XMLSchema-instance"
          xmlns:xsi="slp.xsd"
          xsi:noNamespaceSchemaLocation="slp.xsd">
</document>

So you can see that's not what I need  ---- is there anyone with ideas on
how to accomplish the  generation of the root element as specified at the
begining of the email using jdom.

Cheers,
Sibon.