XSD error in Visual Studio.NET

B

brendang

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>
 
S

Stan Kitsis [MSFT]

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 said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,690
Latest member
MacGyver

Latest Threads

Top