Reference to an undefined name 'X"

  • Posted this in TSQL Last week by accident... think it belongs here instead.

    I'm trying to create the following schema collection, where the "CLAUSE" Attribute defined on line 12 is an enumerated value of either "WHERE" or "VALUES". This code has been validated here -> http://www.w3.org/2001/03/webdata/xsv

    See the error below from SQL2005

    CREATE XML SCHEMA COLLECTION XMLXSD_PENDING_MODIFICATION_TABLE AS

    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://union.rpi.edu">

    <xsd:simpleType name="CLAUSEType">

    <xsd:restriction base="xsd:string">

    <xsd:enumeration value="WHERE" />

    <xsd:enumeration value="VALUES" />

    </xsd:restriction>

    </xsd:simpleType>

    <xsd:complexType name="COLUMNType">

    <xsd:attribute name="NAME" type="xsd:string" use="required" />

    <xsd:attribute name="CLAUSE" type="CLAUSEType" use="required" />

    <xsd:attribute name="VALUE" type="xsd:string" use="required" />

    </xsd:complexType>

    <xsd:complexType name="UPDATEType">

    <xsd:sequence>

    <xsd:element maxOccurs="unbounded" name="COLUMN" type="COLUMNType" />

    </xsd:sequence>

    <xsd:attribute name="ID" type="xsd:dateTime" use="required" />

    <xsd:attribute name="TBL" type="xsd:string" use="required" />

    </xsd:complexType>

    <xsd:complexType name="INSERTType">

    <xsd:sequence>

    <xsd:element maxOccurs="unbounded" name="COLUMN" type="COLUMNType" />

    </xsd:sequence>

    <xsd:attribute name="ID" type="xsd:dateTime" use="required" />

    <xsd:attribute name="TBL" type="xsd:string" use="required" />

    </xsd:complexType>

    <xsd:complexType name="DELETEType">

    <xsd:sequence>

    <xsd:element maxOccurs="unbounded" name="COLUMN" type="COLUMNType" />

    </xsd:sequence>

    <xsd:attribute name="ID" type="xsd:dateTime" use="required" />

    <xsd:attribute name="TBL" type="xsd:string" use="required" />

    </xsd:complexType>

    <xsd:complexType name="PENDING_MODSType">

    <xsd:sequence>

    <xsd:element maxOccurs="unbounded" name="DELETE" type="DELETEType" />

    <xsd:element maxOccurs="unbounded" name="INSERT" type="INSERTType" />

    <xsd:element maxOccurs="unbounded" name="UPDATE" type="UPDATEType" />

    </xsd:sequence>

    </xsd:complexType>

    <xsd:element name="PENDING_MODS" type="PENDING_MODSType" />

    </xsd:schema>'

    Msg 2307, Level 16, State 1, Line 1

    Reference to an undefined name 'CLAUSEType'

    ---
    Dlongnecker

  • Hi,

    I'm not sure whether you figured it out already or not...

    the reason for failure is that your declaration is missing a local namespace definition.

    If you add

    xmlns:ns="http://union.rpi.edu" to your schema definition

    and call

    xsd:attribute name="CLAUSE" type="ns:CLAUSEType" use="required"

    instead of

    xsd:attribute name="CLAUSE" type="CLAUSEType" use="required"

    it's gonna work (at least it did on my machine).

    Please note that you need to add the local namespace to all of your references of internal types (e.g. ns:DELETEType vs. DELETEType a.s.o.)

    SS2K5 will guide you through each missing name space....

    For details please refer to "xsd:simpleType" in BOL.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Sweet. Thanks.

    ---
    Dlongnecker

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply