OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XML Schemas: schemas without a targetNamespace

[ Lists Home | Date Index | Thread Index ]
  • From: "Roger L. Costello" <costello@mitre.org>
  • To: xml-dev@lists.xml.org, costello@mitre.org
  • Date: Sat, 26 Aug 2000 12:28:44 -0400

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS