|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XML Schemas: schemas without a targetNamespace
Hi Folks,
I have three questions about creating an XML Schema with no
targetNamespace:
1. Suppose that I create a schema, BookCatalogue.xsd with no
targetNamespace. Now suppose that I want to create an instance
document, BookCatalogue.xml, which asserts that it conforms to the
schema. How do I do it? I tried two ways and both failed:
a. In the instance document, for the value of schemaLocation I put
one value:
<?xml version="1.0"?>
<BookCatalogue
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:schemaLocation= "BookCatalogue.xsd">
...
</BookCatalogue>
I ran it through XSV and it gave an error "schemaLocation requires
a pair of values". "Hmm", I thought, "how can I give it a pair of
values since the first in the pair specifies a targetNamespace and
there is no targetNamespace? Perhaps the trick is to put a
bogus value in for the first value in the pair?" So, that's
what I tried next...
b. In my second attempt I put a pair of values in for schemaLocation
where the first in the pair is a bogus value:
<?xml version="1.0"?>
<BookCatalogue
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:schemaLocation= "fjdkfsdklfds
BookCatalogue.xsd">
...
</BookCatalogue>
As you might guess, this did not work either. XSV gave me the
error message, "targetNamespace mismatch: fjdkfsdklfds expected,
None found".
Can someone tell me how to do this?
2. I have seen schemas which use "noTargetNamespace". Upon examining
the specs, however, I see no mention of noTargetNamespace. Is that
something from an old working draft that is no longer present?
3. Can someone give me a reason why you would ever want to have no
targetNamespace (i.e., why you would want your schema to have no
namespace for the elements that it declares)?
Thanks! /Roger
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








