XSD error in Visual Studio.NET

Discussion in 'XML' started by brendang, Apr 7, 2005.

  1. brendang

    brendang Guest

    Hi,

    I am getting the following errors on the schema (on the 'Fund_to' and
    'Account_to' elements) in Visual Studio.NET when I try to validate the
    schema itself. I would greatly apreciate any help on this.

    Error messages:

    Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd(128): Type
    'http://citco.com/NTASOrder.xsd:Fund' is not declared. An error
    occurred at Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd,
    (128, 15).

    Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd(129): Type
    'http://citco.com/NTASOrder.xsd:Account' is not declared. An error
    occurred at Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd,
    (129, 15).


    XML where error is occurring:

    <xs:element name="TransferInfo" minOccurs="0" maxOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Fund_to" type="mstns:Fund" />
    <xs:element name="Account_to" type="mstns:Account" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>



    Full XML text:


    <?xml version="1.0" ?>
    <xs:schema id="Msg" targetNamespace="http://xxxxx.com/NNNNOrder.xsd"
    xmlns:mstns="http://xxxxx.com/NNNNOrder.xsd"
    xmlns="http://xxxxx.com/NNNNOrder.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    attributeFormDefault="qualified"
    elementFormDefault="qualified">
    <xs:simpleType name="udDate">
    <xs:restriction base="xs:string">
    <xs:pattern value="\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])"
    />
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="udTime">
    <xs:restriction base="xs:string">
    <xs:pattern value="(0[0-9]|1[01])[:]([012345][0-9])" />
    </xs:restriction>
    </xs:simpleType>
    <xs:element name="Msg">
    <xs:complexType>
    <xs:choice maxOccurs="1">
    <xs:element name="MsgHeader" minOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="MsgTypeId" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="Ooottfff" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="MsgDate" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="udDate" />
    </xs:simpleType>
    </xs:element>
    <xs:element name="MsgTime" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="udTime" />
    </xs:simpleType>
    </xs:element>
    <xs:element name="SourceApp" minOccurs="1"
    type="xs:string"></xs:element>
    <xs:element name="MsgInitiator" type="xs:string" minOccurs="0"
    />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="MsgBody" maxOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Order" minOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="TransactTypeId" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="XX" />
    <xs:enumeration value="YY" />
    <xs:enumeration value="ZZ" />
    <xs:enumeration value="AA" />
    <xs:length value="2" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="CCOOSSS" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="C" />
    <xs:enumeration value="S" />
    <xs:length value="1" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="SSHHHSS" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0" />
    <xs:fractionDigits value="7" />
    <xs:totalDigits value="20" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="CCSSHHTTNDD" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0" />
    <xs:fractionDigits value="2" />
    <xs:totalDigits value="20" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="TTTNNNTE" type="mstns:NNNNNote"
    minOccurs="0" />
    <xs:element name="COMM" minOccurs="1">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="S" />
    <xs:enumeration value="I" />
    <xs:enumeration value="N" />
    <xs:enumeration value="E" />
    <xs:length value="1" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="LoadPercent" type="mstns:percentage"
    minOccurs="1" />
    <xs:element name="TTDDTE" type="mstns:udDate" minOccurs="1"
    />
    <xs:element name="NNNVVDTE"
    type="mstns:udDate"></xs:element>
    <xs:element name="Fund" minOccurs="1" maxOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="FFDDID" type="mstns:NNNNCode"
    minOccurs="1" />
    <xs:element name="FDNME" type="xs:string" minOccurs="1"
    />
    <xs:element name="EXTLID" type="xs:string" />
    <xs:element name="EXTSYS" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="Account" minOccurs="1" maxOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="INVID" type="xs:string" minOccurs="1"
    maxOccurs="1" />
    <xs:element name="FirstName" type="xs:string"
    minOccurs="0" />
    <xs:element name="LastName" type="xs:string"
    minOccurs="0" />
    <xs:element name="HLDID" type="mstns:NNNNCode"
    minOccurs="1" />
    <xs:element name="ACTID" type="mstns:NNNNCode"
    minOccurs="1" />
    <xs:element name="ACTNUM" type="mstns:NNNNCode" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="ExternalReference" type="mstns:NNNNNote"
    minOccurs="1" maxOccurs="1"></xs:element>
    <xs:element name="TransferInfo" minOccurs="0" maxOccurs="1">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Fund_to" type="mstns:Fund" />
    <xs:element name="Account_to" type="mstns:Account" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name="NNNNCode">
    <xs:restriction base="xs:string">
    <xs:maxLength value="16" />
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="Percentage">
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0" />
    <xs:maxExclusive value="100.00" />
    <xs:fractionDigits value="2" />
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="NNNNNote">
    <xs:restriction base="xs:string">
    <xs:maxLength value="45" />
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>
     
    brendang, Apr 7, 2005
    #1
    1. Advertising

  2. You haven't defined types "Fund" and "Account". It looks like you have two
    local elements with the same name. Assuming that they are of the same type
    that you want to use in TransferInfo, you can change your schema to the
    following:

    <?xml version="1.0"?>
    <xs:schema xmlns:mstns="http://xxxxx.com/NNNNOrder.xsd"
    xmlns="http://xxxxx.com/NNNNOrder.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xxxxx.com/NNNNOrder.xsd"
    elementFormDefault="qualified" attributeFormDefault="qualified" id="Msg">
    <xs:simpleType name="udDate">
    <xs:restriction base="xs:string">
    <xs:pattern value="\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="udTime">
    <xs:restriction base="xs:string">
    <xs:pattern value="(0[0-9]|1[01])[:]([012345][0-9])"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:element name="Msg">
    <xs:complexType>
    <xs:choice>
    <xs:element name="MsgHeader">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="MsgTypeId">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:enumeration value="Ooottfff"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="MsgDate">
    <xs:simpleType>
    <xs:restriction base="udDate"/>
    </xs:simpleType>
    </xs:element>
    <xs:element name="MsgTime">
    <xs:simpleType>
    <xs:restriction base="udTime"/>
    </xs:simpleType>
    </xs:element>
    <xs:element name="SourceApp" type="xs:string"/>
    <xs:element name="MsgInitiator" type="xs:string" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="MsgBody">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Order">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="TransactTypeId">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="2"/>
    <xs:enumeration value="XX"/>
    <xs:enumeration value="YY"/>
    <xs:enumeration value="ZZ"/>
    <xs:enumeration value="AA"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="CCOOSSS">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="1"/>
    <xs:enumeration value="C"/>
    <xs:enumeration value="S"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="SSHHHSS">
    <xs:simpleType>
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0"/>
    <xs:fractionDigits value="7"/>
    <xs:totalDigits value="20"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="CCSSHHTTNDD">
    <xs:simpleType>
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0"/>
    <xs:fractionDigits value="2"/>
    <xs:totalDigits value="20"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="TTTNNNTE" type="mstns:NNNNNote" minOccurs="0"/>
    <xs:element name="COMM">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="1"/>
    <xs:enumeration value="S"/>
    <xs:enumeration value="I"/>
    <xs:enumeration value="N"/>
    <xs:enumeration value="E"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="LoadPercent" type="mstns:percentage"/>
    <xs:element name="TTDDTE" type="mstns:udDate"/>
    <xs:element name="NNNVVDTE" type="mstns:udDate"/>
    <xs:element name="Fund" type="mstns:Fund"/>
    <xs:element name="Account" type="mstns:Account"/>
    <xs:element name="ExternalReference" type="mstns:NNNNNote"/>
    <xs:element name="TransferInfo" minOccurs="0">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Fund_to" type="mstns:Fund"/>
    <xs:element name="Account_to" type="mstns:Account"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name="NNNNCode">
    <xs:restriction base="xs:string">
    <xs:maxLength value="16"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="Percentage">
    <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0"/>
    <xs:maxExclusive value="100.00"/>
    <xs:fractionDigits value="2"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="NNNNNote">
    <xs:restriction base="xs:string">
    <xs:maxLength value="45"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="Fund">
    <xs:sequence>
    <xs:element name="FFDDID" type="mstns:NNNNCode"/>
    <xs:element name="FDNME" type="xs:string"/>
    <xs:element name="EXTLID" type="xs:string"/>
    <xs:element name="EXTSYS" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Account">
    <xs:sequence>
    <xs:element name="INVID" type="xs:string"/>
    <xs:element name="FirstName" type="xs:string" minOccurs="0"/>
    <xs:element name="LastName" type="xs:string" minOccurs="0"/>
    <xs:element name="HLDID" type="mstns:NNNNCode"/>
    <xs:element name="ACTID" type="mstns:NNNNCode"/>
    <xs:element name="ACTNUM" type="mstns:NNNNCode"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>


    --
    Stan Kitsis
    Program Manager, XML Technologies
    Microsoft Corporation

    This posting is provided "AS IS" with no warranties, and confers no rights.


    "brendang" <> wrote in message
    news:...
    > Hi,
    >
    > I am getting the following errors on the schema (on the 'Fund_to' and
    > 'Account_to' elements) in Visual Studio.NET when I try to validate the
    > schema itself. I would greatly apreciate any help on this.
    >
    > Error messages:
    >
    > Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd(128): Type
    > 'http://citco.com/NTASOrder.xsd:Fund' is not declared. An error
    > occurred at Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd,
    > (128, 15).
    >
    > Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd(129): Type
    > 'http://citco.com/NTASOrder.xsd:Account' is not declared. An error
    > occurred at Z:\OrdertoFundSchema\OrdertoFundSchema\GridOrderXML.xsd,
    > (129, 15).
    >
    >
    > XML where error is occurring:
    >
    > <xs:element name="TransferInfo" minOccurs="0" maxOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="Fund_to" type="mstns:Fund" />
    > <xs:element name="Account_to" type="mstns:Account" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    >
    >
    >
    > Full XML text:
    >
    >
    > <?xml version="1.0" ?>
    > <xs:schema id="Msg" targetNamespace="http://xxxxx.com/NNNNOrder.xsd"
    > xmlns:mstns="http://xxxxx.com/NNNNOrder.xsd"
    > xmlns="http://xxxxx.com/NNNNOrder.xsd"
    > xmlns:xs="http://www.w3.org/2001/XMLSchema"
    > attributeFormDefault="qualified"
    > elementFormDefault="qualified">
    > <xs:simpleType name="udDate">
    > <xs:restriction base="xs:string">
    > <xs:pattern value="\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])"
    > />
    > </xs:restriction>
    > </xs:simpleType>
    > <xs:simpleType name="udTime">
    > <xs:restriction base="xs:string">
    > <xs:pattern value="(0[0-9]|1[01])[:]([012345][0-9])" />
    > </xs:restriction>
    > </xs:simpleType>
    > <xs:element name="Msg">
    > <xs:complexType>
    > <xs:choice maxOccurs="1">
    > <xs:element name="MsgHeader" minOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="MsgTypeId" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="Ooottfff" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="MsgDate" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="udDate" />
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="MsgTime" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="udTime" />
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="SourceApp" minOccurs="1"
    > type="xs:string"></xs:element>
    > <xs:element name="MsgInitiator" type="xs:string" minOccurs="0"
    > />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > <xs:element name="MsgBody" maxOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="Order" minOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="TransactTypeId" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="XX" />
    > <xs:enumeration value="YY" />
    > <xs:enumeration value="ZZ" />
    > <xs:enumeration value="AA" />
    > <xs:length value="2" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="CCOOSSS" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="C" />
    > <xs:enumeration value="S" />
    > <xs:length value="1" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="SSHHHSS" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:decimal">
    > <xs:minInclusive value="0" />
    > <xs:fractionDigits value="7" />
    > <xs:totalDigits value="20" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="CCSSHHTTNDD" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:decimal">
    > <xs:minInclusive value="0" />
    > <xs:fractionDigits value="2" />
    > <xs:totalDigits value="20" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="TTTNNNTE" type="mstns:NNNNNote"
    > minOccurs="0" />
    > <xs:element name="COMM" minOccurs="1">
    > <xs:simpleType>
    > <xs:restriction base="xs:string">
    > <xs:enumeration value="S" />
    > <xs:enumeration value="I" />
    > <xs:enumeration value="N" />
    > <xs:enumeration value="E" />
    > <xs:length value="1" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:element>
    > <xs:element name="LoadPercent" type="mstns:percentage"
    > minOccurs="1" />
    > <xs:element name="TTDDTE" type="mstns:udDate" minOccurs="1"
    > />
    > <xs:element name="NNNVVDTE"
    > type="mstns:udDate"></xs:element>
    > <xs:element name="Fund" minOccurs="1" maxOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="FFDDID" type="mstns:NNNNCode"
    > minOccurs="1" />
    > <xs:element name="FDNME" type="xs:string" minOccurs="1"
    > />
    > <xs:element name="EXTLID" type="xs:string" />
    > <xs:element name="EXTSYS" type="xs:string" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > <xs:element name="Account" minOccurs="1" maxOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="INVID" type="xs:string" minOccurs="1"
    > maxOccurs="1" />
    > <xs:element name="FirstName" type="xs:string"
    > minOccurs="0" />
    > <xs:element name="LastName" type="xs:string"
    > minOccurs="0" />
    > <xs:element name="HLDID" type="mstns:NNNNCode"
    > minOccurs="1" />
    > <xs:element name="ACTID" type="mstns:NNNNCode"
    > minOccurs="1" />
    > <xs:element name="ACTNUM" type="mstns:NNNNCode" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > <xs:element name="ExternalReference" type="mstns:NNNNNote"
    > minOccurs="1" maxOccurs="1"></xs:element>
    > <xs:element name="TransferInfo" minOccurs="0" maxOccurs="1">
    > <xs:complexType>
    > <xs:sequence>
    > <xs:element name="Fund_to" type="mstns:Fund" />
    > <xs:element name="Account_to" type="mstns:Account" />
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > </xs:sequence>
    > </xs:complexType>
    > </xs:element>
    > </xs:choice>
    > </xs:complexType>
    > </xs:element>
    > <xs:simpleType name="NNNNCode">
    > <xs:restriction base="xs:string">
    > <xs:maxLength value="16" />
    > </xs:restriction>
    > </xs:simpleType>
    > <xs:simpleType name="Percentage">
    > <xs:restriction base="xs:decimal">
    > <xs:minInclusive value="0" />
    > <xs:maxExclusive value="100.00" />
    > <xs:fractionDigits value="2" />
    > </xs:restriction>
    > </xs:simpleType>
    > <xs:simpleType name="NNNNNote">
    > <xs:restriction base="xs:string">
    > <xs:maxLength value="45" />
    > </xs:restriction>
    > </xs:simpleType>
    > </xs:schema>
     
    Stan Kitsis [MSFT], Apr 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    597
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    752
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    696
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    578
  5. xman
    Replies:
    1
    Views:
    664
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page