Re: Non-native attributes

MessageThanks for catching that! Is Bob Schloss comment then the wrong way to do it or an alternative way to do it?

  ----- Original Message ----- 
  From: Priscilla Walmsley 
  To: 'Sal Mangano' ; xmlschema-dev@w3.org ; 'Bob Schloss' 
  Sent: Wednesday, July 10, 2002 1:50 PM
  Subject: RE: Non-native attributes


  Hi Sal, 

  The problem is that in your main schema you have the instance namespace misspelled (XMLScheam instead of XMLSchema).

  After fixing this your example works just fine in XSV and Xerces 2.0.1.  Unfortunately, though, neither tool checks that the value of the joindef attribute is a valid boolean - XSV because it does not do all validation of simple types (it _will_ raise appropriate errors if joindef is declared as xs:integer), and Xerces apparently because it does not consult the other schema.  

  I'm not sure why XML Spy gives you that message but you might try taking the schemaLocation attribute out of the main schema.  Since you won't be able to validate the value of joindef with available tools anyway, it is not accomplishing anything.  

  Bob, he is trying to validate a non-native attribute that he is using on the element element, not an attribute he is using in a complex type definition (one meta level away), so import is not necessary here.   

  Thanks,
  Priscilla
  -----------------------------------------------------
  Priscilla Walmsley             priscilla@walmsley.com
  Author, Definitive XML Schema     (Prentice Hall PTR)
  ----------------------------------------------------- 
    -----Original Message-----
    From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On Behalf Of Sal Mangano
    Sent: Wednesday, July 10, 2002 1:14 PM
    To: xmlschema-dev@w3.org; Bob Schloss
    Subject: Re: Non-native attributes


    Thanks. I derived this from an example in "Definitive XML Schema" by P. Welmsey p.103. Either I read it wrong or the example is in error.

      ----- Original Message ----- 
      From: Bob Schloss 
      To: Sal Mangano ; xmlschema-dev@w3.org 
      Sent: Wednesday, July 10, 2002 12:06 PM
      Subject: Re: Non-native attributes


      If a non-native attribute is an attribute declare in a different targetNamespace, then normally you would include in the using schema an import element information item. 

      Something like
      <xs:import namespace="http://www.morganstanley.com/fid/db" schemaLocation="..."/>
      although the schemaLocation is technically optional.

      I can see that you may not be completely clear about namespace and incorporated document handling in schema, because the xsi:schemaLocation attribute which you have on your schema element makes no sense. All the attribute in the xsi: namespace are intended to be used in instance documents, not in schemas. 

      Note that a good schema diagnostic tool (and one I contributed to) is the IBM XML Schema Quality Checker. You can download it from http://www.alphaworks.ibm.com/tech/xmlsqc . It often finds subtle errors not found by XMLSpy, and sometimes suggests the appropriate change to your schema.

      Another good tool is XSV. A complete list of tools is at http://www.w3.org/XML/Schema .

      Bob Schloss
      IBM T. J. Watson Research Center
      Hawthorne, NY, USA



      Sent by: xmlschema-dev-request@w3.org 

      To: <xmlschema-dev@w3.org>
      cc: 
      Subject: Non-native attributes




      I am designing a XSD schema in XML Spy v4.4 that uses a non-native
      attribute. XML Spy is complaining that the schema that defines my non-native
      attribute
      has "no content model". Am I doing something wrong or is this the tools
      problem. See below.

      This is my main scheama:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 

        xmlns:db="http://www.morganstanley.com/fid/db"
        xmlns:xsi="http://www.w3.org/2001/XMLScheam-instance"
        xsi:schemaLocation="http://www.morganstanley.com/fid/db
      u:/dev/mapml/db.xsd">

      <xs:element name="SwapMain">
      <xs:annotation> 
        <xs:documentation>The main Swap Table in the database</xs:documentation>
        </xs:annotation>
        <xs:complexType>
        <xs:sequence>
        <xs:element name="SName" type="xs:string" db:joindef="true"/>
        <xs:element name="SStatus"/>

        <!-- Lots more irrelevant stuff here ...-->

        </xs:sequence>
        </xs:complexType>
      </xs:element>

        <!-- Lots more irrelevant stuff here ...-->

      </xs:schema>



      This is the schema defining the non-native attribute:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema targetNamespace="http://www.morganstanley.com/fid/db"
      xmlns="http://www.morganstanley.com/fid/db"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:attribute name="joindef" type="xs:boolean">
      <xs:annotation>
      <xs:documentation>Attach this attribute to fields that define the
      collection of all data that are decendants of the root.</xs:documentation>
      </xs:annotation>
      </xs:attribute>
      </xs:schema>

Received on Wednesday, 10 July 2002 14:07:31 UTC