473,692 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlSchemaSet Compile error ?

Here under 4 schemas i'm working with ( it may be long: sorry...)
The context is the following :
Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema:
no TargetNamespace )
Person.xsd includes Common-Naming.xsd ( anonimous schemas )
Common-Naming.xsd includes common.xsd ( both are anonimous schemas )

Compilation of Resident.xsd raise the following exception:
"System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already
exists...."

That is wrong : the schemas are valid and well done ( Xml-Spy ).

The problem seems to be that Common.xsd appears twice: one time in
Resident.xsd and an other time in Person.xsd. i tried to put Common.xsd &
Common-Naming.xsd in a same file it doesn't change anything.

Thank for any help because i'm currently freezed in my dev....

<!-- COMMON.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonSpace ">
<xs:group name="IEntity">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
</xs:sequence>
</xs:group>
<xs:complexTy pe name="BusinessE ntityType">
<xs:sequence>
<xs:group ref="IEntity"/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="EntityRef Type">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
<xs:element name="Descripti on" type="xs:string "/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="RefType">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:attribute name="type" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:attributeGr oup name="ISqlEntit y">
<xs:attribute name="oid" type="xs:string "/>
</xs:attributeGro up>
</xs:schema>
<!-- COMMON-NAMING.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonNamin gSpace">
<xs:include schemaLocation= "Common.xsd " />
<xs:simpleTyp e name="SexeTypol ogy">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="M" />
<xs:enumerati on value="F" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CivilityT ypology">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="c1:MRS" />
<xs:enumerati on value="c2:MISS" />
<xs:enumerati on value="c3:MR" />
<xs:enumerati on value="c4:DOC" />
<xs:enumerati on value="c5:PROF" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="CivilityT ype">
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="type" type="CivilityT ypology"
default="c3:MR" />
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
<xs:complexTy pe name="NameType" >
<xs:sequence>
<xs:element name="Civility" type="CivilityT ype" />
<xs:element name="First" type="xs:string " />
<xs:element name="Last" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
<!-- PERSON.XSD -->
<xs:schema xmlns="http://copro/Copro.Persons"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://copro/Copro.Persons" elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="PersonSpace ">
<xs:include schemaLocation= "Common-Naming.xsd" />
<xs:simpleTyp e name="FamillySt atus">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="SINGLE" />
<xs:enumerati on value="MARIED" />
<xs:enumerati on value="WEADOW" />
<xs:enumerati on value="UNDEFINE D" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CommonSha redActivity">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="Jardinag e" />
<xs:enumerati on value="Musique" />
<xs:enumerati on value="Informat ique" />
<xs:enumerati on value="Baby-Sisting" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="PersonTyp e">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Name" type="NameType" />
<xs:element name="ArrivalDa te" type="xs:date"
minOccurs="0" />
<xs:element name="IsCoproMa nager" type="xs:boolea n"
default="false" minOccurs="0" />
<xs:element name="FamillySt atus" type="FamillySt atus"
default="UNDEFI NED" minOccurs="0" />
<xs:element name="BirthDay" type="xs:dateTi me"
minOccurs="0" />
<xs:element name="Email" type="xs:string " minOccurs="0" />
<xs:element name="SharedAct ivity" type="xs:string "
minOccurs="0" maxOccurs="unbo unded" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:complexTy pe name="PersonRef Type">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:sequence>
<xs:element ref="Person" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Person" type="PersonTyp e">
<xs:unique name="PersonByR eference">
<xs:selector xpath="." />
<xs:field xpath="Referenc e" />
</xs:unique>
</xs:element>
</xs:schema>
<!-- RESIDENT.XSD -->
<xs:schema xmlns="http://copro/Copro.Residents "
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://copro/Copro.Persons"
targetNamespace ="http://copro/Copro.Residents " elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
<xs:include schemaLocation= "Common.xsd "/>
<xs:import namespace="http ://copro/Copro.Persons"
schemaLocation= "Person.xsd "/>
<xs:complexTy pe name="ResidentT ype">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/>
<xs:element name="Person" type="p:PersonR efType" maxOccurs="unbo unded"/>
<!--
<xs:element ref="p:Person" maxOccurs="unbo unded"/>
-->
</xs:sequence>
<xs:attribute name="copro" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Resident" type="ResidentT ype"/>
</xs:schema>
Nov 12 '05 #1
5 3810
Hello Zafar,

First of all thank for your answer :O)

This is a preview platform :
my .net framework is v2.0.50215
I've two platforms with this version of .net framework :
- XP + VS Beta 1
- Server 2003 + SQL Server 2005 CPT June ( running in virtual PC on
previous platform )
both raise the same error.

may i know what is your version ?

"Zafar Abbas" wrote:
I am able to save all 4 files as XSD schemas, and compile Residents.xsd
using the XmlSchemaSet without any problems.
What version of the .net framework are you using and how does your code look
like?

Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
Here under 4 schemas i'm working with ( it may be long: sorry...)
The context is the following :
Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous

schema:
no TargetNamespace )
Person.xsd includes Common-Naming.xsd ( anonimous schemas )
Common-Naming.xsd includes common.xsd ( both are anonimous schemas )

Compilation of Resident.xsd raise the following exception:
"System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already
exists...."

That is wrong : the schemas are valid and well done ( Xml-Spy ).

The problem seems to be that Common.xsd appears twice: one time in
Resident.xsd and an other time in Person.xsd. i tried to put Common.xsd &
Common-Naming.xsd in a same file it doesn't change anything.

Thank for any help because i'm currently freezed in my dev....

<!-- COMMON.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonSpace ">
<xs:group name="IEntity">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
</xs:sequence>
</xs:group>
<xs:complexTy pe name="BusinessE ntityType">
<xs:sequence>
<xs:group ref="IEntity"/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="EntityRef Type">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
<xs:element name="Descripti on" type="xs:string "/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="RefType">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:attribute name="type" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:attributeGr oup name="ISqlEntit y">
<xs:attribute name="oid" type="xs:string "/>
</xs:attributeGro up>
</xs:schema>
<!-- COMMON-NAMING.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonNamin gSpace">
<xs:include schemaLocation= "Common.xsd " />
<xs:simpleTyp e name="SexeTypol ogy">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="M" />
<xs:enumerati on value="F" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CivilityT ypology">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="c1:MRS" />
<xs:enumerati on value="c2:MISS" />
<xs:enumerati on value="c3:MR" />
<xs:enumerati on value="c4:DOC" />
<xs:enumerati on value="c5:PROF" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="CivilityT ype">
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="type" type="CivilityT ypology"
default="c3:MR" />
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
<xs:complexTy pe name="NameType" >
<xs:sequence>
<xs:element name="Civility" type="CivilityT ype" />
<xs:element name="First" type="xs:string " />
<xs:element name="Last" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
<!-- PERSON.XSD -->
<xs:schema xmlns="http://copro/Copro.Persons"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://copro/Copro.Persons"

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="PersonSpace ">
<xs:include schemaLocation= "Common-Naming.xsd" />
<xs:simpleTyp e name="FamillySt atus">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="SINGLE" />
<xs:enumerati on value="MARIED" />
<xs:enumerati on value="WEADOW" />
<xs:enumerati on value="UNDEFINE D" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CommonSha redActivity">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="Jardinag e" />
<xs:enumerati on value="Musique" />
<xs:enumerati on value="Informat ique" />
<xs:enumerati on value="Baby-Sisting" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="PersonTyp e">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Name" type="NameType" />
<xs:element name="ArrivalDa te" type="xs:date"
minOccurs="0" />
<xs:element name="IsCoproMa nager" type="xs:boolea n"
default="false" minOccurs="0" />
<xs:element name="FamillySt atus" type="FamillySt atus"
default="UNDEFI NED" minOccurs="0" />
<xs:element name="BirthDay" type="xs:dateTi me"
minOccurs="0" />
<xs:element name="Email" type="xs:string "

minOccurs="0" />
<xs:element name="SharedAct ivity" type="xs:string "
minOccurs="0" maxOccurs="unbo unded" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:complexTy pe name="PersonRef Type">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:sequence>
<xs:element ref="Person" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Person" type="PersonTyp e">
<xs:unique name="PersonByR eference">
<xs:selector xpath="." />
<xs:field xpath="Referenc e" />
</xs:unique>
</xs:element>
</xs:schema>
<!-- RESIDENT.XSD -->
<xs:schema xmlns="http://copro/Copro.Residents "
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://copro/Copro.Persons"
targetNamespace ="http://copro/Copro.Residents "

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
<xs:include schemaLocation= "Common.xsd "/>
<xs:import namespace="http ://copro/Copro.Persons"
schemaLocation= "Person.xsd "/>
<xs:complexTy pe name="ResidentT ype">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/>
<xs:element name="Person" type="p:PersonR efType" maxOccurs="unbo unded"/>
<!--
<xs:element ref="p:Person" maxOccurs="unbo unded"/>
-->
</xs:sequence>
<xs:attribute name="copro" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Resident" type="ResidentT ype"/>
</xs:schema>


Nov 12 '05 #2
Hello,

Just for info i run the program again : here is the console output :

Current dir: D:\Projects\Cop ro\Copro.Schema s\bin\Debug
Current dir: D:\Projects\Cop ro\Copro.Schema s
loading: Resident.xsd
loaded: Resident.xsd
loaded schemas : 2
System.Xml.Sche ma.XmlSchemaExc eption: The attribute 'oid' already exists.
System.Exceptio n: Compile error ---> System.Xml.Sche ma.XmlSchemaExc eption:
The attribute 'oid' already exists.
--- End of inner exception stack trace ---
at Schema.Program. schemaSet_Valid ationEventHandl er(Object sender,
ValidationEvent Args e) in D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 58
at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at System.Xml.Sche ma.Compiler.Com pileLocalAttrib utes(XmlSchemaC omplexType
baseType, XmlSchemaComple xType derivedType, XmlSchemaObject Collection
attributes, XmlSchemaAnyAtt ribute anyAttribute, XmlSchemaDeriva tionMethod
derivedBy)
at System.Xml.Sche ma.Compiler.Com pileComplexType (XmlSchemaCompl exType
complexType)
at System.Xml.Sche ma.Compiler.Com pile()
at System.Xml.Sche ma.Compiler.Exe cute(XmlSchemaS et schemaSet, Boolean
compileContentM odel, SchemaInfo schemaCompiledI nfo)
at System.Xml.Sche ma.XmlSchemaSet .Compile()
at Schema.Program. Main(String[] args) in
D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 40
Compile failed...

regards

"Zafar Abbas" wrote:
I am able to save all 4 files as XSD schemas, and compile Residents.xsd
using the XmlSchemaSet without any problems.
What version of the .net framework are you using and how does your code look
like?

Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
Here under 4 schemas i'm working with ( it may be long: sorry...)
The context is the following :
Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous

schema:
no TargetNamespace )
Person.xsd includes Common-Naming.xsd ( anonimous schemas )
Common-Naming.xsd includes common.xsd ( both are anonimous schemas )

Compilation of Resident.xsd raise the following exception:
"System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already
exists...."

That is wrong : the schemas are valid and well done ( Xml-Spy ).

The problem seems to be that Common.xsd appears twice: one time in
Resident.xsd and an other time in Person.xsd. i tried to put Common.xsd &
Common-Naming.xsd in a same file it doesn't change anything.

Thank for any help because i'm currently freezed in my dev....

<!-- COMMON.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonSpace ">
<xs:group name="IEntity">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
</xs:sequence>
</xs:group>
<xs:complexTy pe name="BusinessE ntityType">
<xs:sequence>
<xs:group ref="IEntity"/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="EntityRef Type">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
<xs:element name="Descripti on" type="xs:string "/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="RefType">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:attribute name="type" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:attributeGr oup name="ISqlEntit y">
<xs:attribute name="oid" type="xs:string "/>
</xs:attributeGro up>
</xs:schema>
<!-- COMMON-NAMING.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonNamin gSpace">
<xs:include schemaLocation= "Common.xsd " />
<xs:simpleTyp e name="SexeTypol ogy">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="M" />
<xs:enumerati on value="F" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CivilityT ypology">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="c1:MRS" />
<xs:enumerati on value="c2:MISS" />
<xs:enumerati on value="c3:MR" />
<xs:enumerati on value="c4:DOC" />
<xs:enumerati on value="c5:PROF" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="CivilityT ype">
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="type" type="CivilityT ypology"
default="c3:MR" />
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
<xs:complexTy pe name="NameType" >
<xs:sequence>
<xs:element name="Civility" type="CivilityT ype" />
<xs:element name="First" type="xs:string " />
<xs:element name="Last" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
<!-- PERSON.XSD -->
<xs:schema xmlns="http://copro/Copro.Persons"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://copro/Copro.Persons"

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="PersonSpace ">
<xs:include schemaLocation= "Common-Naming.xsd" />
<xs:simpleTyp e name="FamillySt atus">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="SINGLE" />
<xs:enumerati on value="MARIED" />
<xs:enumerati on value="WEADOW" />
<xs:enumerati on value="UNDEFINE D" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CommonSha redActivity">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="Jardinag e" />
<xs:enumerati on value="Musique" />
<xs:enumerati on value="Informat ique" />
<xs:enumerati on value="Baby-Sisting" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="PersonTyp e">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Name" type="NameType" />
<xs:element name="ArrivalDa te" type="xs:date"
minOccurs="0" />
<xs:element name="IsCoproMa nager" type="xs:boolea n"
default="false" minOccurs="0" />
<xs:element name="FamillySt atus" type="FamillySt atus"
default="UNDEFI NED" minOccurs="0" />
<xs:element name="BirthDay" type="xs:dateTi me"
minOccurs="0" />
<xs:element name="Email" type="xs:string "

minOccurs="0" />
<xs:element name="SharedAct ivity" type="xs:string "
minOccurs="0" maxOccurs="unbo unded" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:complexTy pe name="PersonRef Type">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:sequence>
<xs:element ref="Person" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Person" type="PersonTyp e">
<xs:unique name="PersonByR eference">
<xs:selector xpath="." />
<xs:field xpath="Referenc e" />
</xs:unique>
</xs:element>
</xs:schema>
<!-- RESIDENT.XSD -->
<xs:schema xmlns="http://copro/Copro.Residents "
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://copro/Copro.Persons"
targetNamespace ="http://copro/Copro.Residents "

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
<xs:include schemaLocation= "Common.xsd "/>
<xs:import namespace="http ://copro/Copro.Persons"
schemaLocation= "Person.xsd "/>
<xs:complexTy pe name="ResidentT ype">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/>
<xs:element name="Person" type="p:PersonR efType" maxOccurs="unbo unded"/>
<!--
<xs:element ref="p:Person" maxOccurs="unbo unded"/>
-->
</xs:sequence>
<xs:attribute name="copro" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Resident" type="ResidentT ype"/>
</xs:schema>


Nov 12 '05 #3
Could you please share your code, so I could try it and let you know.
Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message
news:2B******** *************** ***********@mic rosoft.com...
Hello,

Just for info i run the program again : here is the console output :

Current dir: D:\Projects\Cop ro\Copro.Schema s\bin\Debug
Current dir: D:\Projects\Cop ro\Copro.Schema s
loading: Resident.xsd
loaded: Resident.xsd
loaded schemas : 2
System.Xml.Sche ma.XmlSchemaExc eption: The attribute 'oid' already exists.
System.Exceptio n: Compile error ---> System.Xml.Sche ma.XmlSchemaExc eption:
The attribute 'oid' already exists.
--- End of inner exception stack trace ---
at Schema.Program. schemaSet_Valid ationEventHandl er(Object sender,
ValidationEvent Args e) in D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 58 at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException e, XmlSeverityType severity)
at System.Xml.Sche ma.Compiler.Com pileLocalAttrib utes(XmlSchemaC omplexType baseType, XmlSchemaComple xType derivedType, XmlSchemaObject Collection
attributes, XmlSchemaAnyAtt ribute anyAttribute, XmlSchemaDeriva tionMethod
derivedBy)
at System.Xml.Sche ma.Compiler.Com pileComplexType (XmlSchemaCompl exType
complexType)
at System.Xml.Sche ma.Compiler.Com pile()
at System.Xml.Sche ma.Compiler.Exe cute(XmlSchemaS et schemaSet, Boolean
compileContentM odel, SchemaInfo schemaCompiledI nfo)
at System.Xml.Sche ma.XmlSchemaSet .Compile()
at Schema.Program. Main(String[] args) in
D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 40
Compile failed...

regards

"Zafar Abbas" wrote:
I am able to save all 4 files as XSD schemas, and compile Residents.xsd
using the XmlSchemaSet without any problems.
What version of the .net framework are you using and how does your code look like?

Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message news:1B******** *************** ***********@mic rosoft.com...
Here under 4 schemas i'm working with ( it may be long: sorry...)
The context is the following :
Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous

schema:
no TargetNamespace )
Person.xsd includes Common-Naming.xsd ( anonimous schemas )
Common-Naming.xsd includes common.xsd ( both are anonimous schemas )

Compilation of Resident.xsd raise the following exception:
"System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already
exists...."

That is wrong : the schemas are valid and well done ( Xml-Spy ).

The problem seems to be that Common.xsd appears twice: one time in
Resident.xsd and an other time in Person.xsd. i tried to put Common.xsd & Common-Naming.xsd in a same file it doesn't change anything.

Thank for any help because i'm currently freezed in my dev....

<!-- COMMON.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonSpace ">
<xs:group name="IEntity">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
</xs:sequence>
</xs:group>
<xs:complexTy pe name="BusinessE ntityType">
<xs:sequence>
<xs:group ref="IEntity"/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="EntityRef Type">
<xs:sequence>
<xs:element name="Reference " type="xs:string "/>
<xs:element name="Descripti on" type="xs:string "/>
</xs:sequence>
<xs:attributeGr oup ref="ISqlEntity "/>
</xs:complexType>
<xs:complexTy pe name="RefType">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:attribute name="type" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:attributeGr oup name="ISqlEntit y">
<xs:attribute name="oid" type="xs:string "/>
</xs:attributeGro up>
</xs:schema>
<!-- COMMON-NAMING.XSD -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
id="CommonNamin gSpace">
<xs:include schemaLocation= "Common.xsd " />
<xs:simpleTyp e name="SexeTypol ogy">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="M" />
<xs:enumerati on value="F" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CivilityT ypology">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="c1:MRS" />
<xs:enumerati on value="c2:MISS" />
<xs:enumerati on value="c3:MR" />
<xs:enumerati on value="c4:DOC" />
<xs:enumerati on value="c5:PROF" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="CivilityT ype">
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="type" type="CivilityT ypology"
default="c3:MR" />
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
<xs:complexTy pe name="NameType" >
<xs:sequence>
<xs:element name="Civility" type="CivilityT ype" />
<xs:element name="First" type="xs:string " />
<xs:element name="Last" type="xs:string " />
</xs:sequence>
</xs:complexType>
</xs:schema>
<!-- PERSON.XSD -->
<xs:schema xmlns="http://copro/Copro.Persons"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://copro/Copro.Persons"

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="PersonSpace ">
<xs:include schemaLocation= "Common-Naming.xsd" />
<xs:simpleTyp e name="FamillySt atus">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="SINGLE" />
<xs:enumerati on value="MARIED" />
<xs:enumerati on value="WEADOW" />
<xs:enumerati on value="UNDEFINE D" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="CommonSha redActivity">
<xs:restricti on base="xs:string ">
<xs:enumerati on value="Jardinag e" />
<xs:enumerati on value="Musique" />
<xs:enumerati on value="Informat ique" />
<xs:enumerati on value="Baby-Sisting" />
</xs:restriction>
</xs:simpleType>
<xs:complexTy pe name="PersonTyp e">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Name" type="NameType" />
<xs:element name="ArrivalDa te" type="xs:date"
minOccurs="0" />
<xs:element name="IsCoproMa nager" type="xs:boolea n" default="false" minOccurs="0" />
<xs:element name="FamillySt atus" type="FamillySt atus" default="UNDEFI NED" minOccurs="0" />
<xs:element name="BirthDay" type="xs:dateTi me"
minOccurs="0" />
<xs:element name="Email" type="xs:string "

minOccurs="0" />
<xs:element name="SharedAct ivity" type="xs:string "
minOccurs="0" maxOccurs="unbo unded" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:complexTy pe name="PersonRef Type">
<xs:complexCont ent>
<xs:extension base="EntityRef Type">
<xs:sequence>
<xs:element ref="Person" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Person" type="PersonTyp e">
<xs:unique name="PersonByR eference">
<xs:selector xpath="." />
<xs:field xpath="Referenc e" />
</xs:unique>
</xs:element>
</xs:schema>
<!-- RESIDENT.XSD -->
<xs:schema xmlns="http://copro/Copro.Residents "
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:p="http://copro/Copro.Persons"
targetNamespace ="http://copro/Copro.Residents "

elementFormDefa ult="qualified"
attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
<xs:include schemaLocation= "Common.xsd "/>
<xs:import namespace="http ://copro/Copro.Persons"
schemaLocation= "Person.xsd "/>
<xs:complexTy pe name="ResidentT ype">
<xs:complexCont ent>
<xs:extension base="BusinessE ntityType">
<xs:sequence>
<xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/>
<xs:element name="Person" type="p:PersonR efType" maxOccurs="unbo unded"/> <!--
<xs:element ref="p:Person" maxOccurs="unbo unded"/>
-->
</xs:sequence>
<xs:attribute name="copro" type="xs:string "/>
</xs:extension>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="Resident" type="ResidentT ype"/>
</xs:schema>


Nov 12 '05 #4
I would have send a zip if it was possible but i don't kown how to do it on a
thread.
( i guess it's not possible.. ) so here is my little console program.

As i put all my XML-Schemas in the Console Project i reset the working "dir"
first, otherwise you can't do more simple...

Thanks again for your help.

using System.Xml.Seri alization;

namespace Schema
{
class Program
{
private const string shemaName = @"Resident.xsd" ;

[STAThread]
static void Main( string[] args )
{
string currentDir = Directory.GetCu rrentDirectory( );
Console.WriteLi ne( "Current dir: {0}",
currentDir );
string path = Path.Combine( currentDir,
@"..\.." );
Directory.SetCu rrentDirectory( path);
currentDir = Directory.GetCu rrentDirectory( );
Console.WriteLi ne( "Current dir: {0}",
currentDir );
path = Path.Combine( currentDir, shemaName );
XmlSchema schema = null;
Console.WriteLi ne( "loading: " + shemaName );
using ( Stream stream = new FileStream( path,
FileMode.Open, FileAccess.Read , FileShare.Read ) )
{
XmlReader xr = new XmlTextReader(
stream );
schema =
System.Xml.Sche ma.XmlSchema.Re ad( xr, null );
}
Console.WriteLi ne( "loaded: " + shemaName );
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add( schema );
Console.WriteLi ne( "loaded schemas : " +
schemaSet.Count );

try
{

schemaSet.Valid ationEventHandl er+=new ValidationEvent Handler(
schemaSet_Valid ationEventHandl er );
schemaSet.Compi le();
}
catch(Exception e )
{
Console.WriteLi ne( e.ToString());
}

if( schemaSet.IsCom piled )
Console.WriteLi ne( "Compile done..." );
else
Console.WriteLi ne( "Compile failed..." );

Console.Read();
}

static void schemaSet_Valid ationEventHandl er( object
sender, ValidationEvent Args e )
{
Console.WriteLi ne( e.Exception.ToS tring() );
throw new Exception( "Compile error",
e.Exception );
}
}
}
"Zafar Abbas" wrote:
Could you please share your code, so I could try it and let you know.
Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message
news:2B******** *************** ***********@mic rosoft.com...
Hello,

Just for info i run the program again : here is the console output :

Current dir: D:\Projects\Cop ro\Copro.Schema s\bin\Debug
Current dir: D:\Projects\Cop ro\Copro.Schema s
loading: Resident.xsd
loaded: Resident.xsd
loaded schemas : 2
System.Xml.Sche ma.XmlSchemaExc eption: The attribute 'oid' already exists.
System.Exceptio n: Compile error ---> System.Xml.Sche ma.XmlSchemaExc eption:
The attribute 'oid' already exists.
--- End of inner exception stack trace ---
at Schema.Program. schemaSet_Valid ationEventHandl er(Object sender,
ValidationEvent Args e) in D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne

58
at

System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at

System.Xml.Sche ma.Compiler.Com pileLocalAttrib utes(XmlSchemaC omplexType
baseType, XmlSchemaComple xType derivedType, XmlSchemaObject Collection
attributes, XmlSchemaAnyAtt ribute anyAttribute, XmlSchemaDeriva tionMethod
derivedBy)
at System.Xml.Sche ma.Compiler.Com pileComplexType (XmlSchemaCompl exType
complexType)
at System.Xml.Sche ma.Compiler.Com pile()
at System.Xml.Sche ma.Compiler.Exe cute(XmlSchemaS et schemaSet, Boolean
compileContentM odel, SchemaInfo schemaCompiledI nfo)
at System.Xml.Sche ma.XmlSchemaSet .Compile()
at Schema.Program. Main(String[] args) in
D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 40
Compile failed...

regards

"Zafar Abbas" wrote:
I am able to save all 4 files as XSD schemas, and compile Residents.xsd
using the XmlSchemaSet without any problems.
What version of the .net framework are you using and how does your code look like?

Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message news:1B******** *************** ***********@mic rosoft.com...
> Here under 4 schemas i'm working with ( it may be long: sorry...)
> The context is the following :
> Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous
schema:
> no TargetNamespace )
> Person.xsd includes Common-Naming.xsd ( anonimous schemas )
> Common-Naming.xsd includes common.xsd ( both are anonimous schemas )
>
> Compilation of Resident.xsd raise the following exception:
> "System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already
> exists...."
>
> That is wrong : the schemas are valid and well done ( Xml-Spy ).
>
> The problem seems to be that Common.xsd appears twice: one time in
> Resident.xsd and an other time in Person.xsd. i tried to put Common.xsd & > Common-Naming.xsd in a same file it doesn't change anything.
>
> Thank for any help because i'm currently freezed in my dev....
>
> <!-- COMMON.XSD -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
> id="CommonSpace ">
> <xs:group name="IEntity">
> <xs:sequence>
> <xs:element name="Reference " type="xs:string "/>
> </xs:sequence>
> </xs:group>
> <xs:complexTy pe name="BusinessE ntityType">
> <xs:sequence>
> <xs:group ref="IEntity"/>
> </xs:sequence>
> <xs:attributeGr oup ref="ISqlEntity "/>
> </xs:complexType>
> <xs:complexTy pe name="EntityRef Type">
> <xs:sequence>
> <xs:element name="Reference " type="xs:string "/>
> <xs:element name="Descripti on" type="xs:string "/>
> </xs:sequence>
> <xs:attributeGr oup ref="ISqlEntity "/>
> </xs:complexType>
> <xs:complexTy pe name="RefType">
> <xs:complexCont ent>
> <xs:extension base="EntityRef Type">
> <xs:attribute name="type" type="xs:string "/>
> </xs:extension>
> </xs:complexConte nt>
> </xs:complexType>
> <xs:attributeGr oup name="ISqlEntit y">
> <xs:attribute name="oid" type="xs:string "/>
> </xs:attributeGro up>
> </xs:schema>
> <!-- COMMON-NAMING.XSD -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
> id="CommonNamin gSpace">
> <xs:include schemaLocation= "Common.xsd " />
> <xs:simpleTyp e name="SexeTypol ogy">
> <xs:restricti on base="xs:string ">
> <xs:enumerati on value="M" />
> <xs:enumerati on value="F" />
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleTyp e name="CivilityT ypology">
> <xs:restricti on base="xs:string ">
> <xs:enumerati on value="c1:MRS" />
> <xs:enumerati on value="c2:MISS" />
> <xs:enumerati on value="c3:MR" />
> <xs:enumerati on value="c4:DOC" />
> <xs:enumerati on value="c5:PROF" />
> </xs:restriction>
> </xs:simpleType>
> <xs:complexTy pe name="CivilityT ype">
> <xs:simpleConte nt>
> <xs:extension base="xs:string ">
> <xs:attribute name="type" type="CivilityT ypology"
> default="c3:MR" />
> </xs:extension>
> </xs:simpleConten t>
> </xs:complexType>
> <xs:complexTy pe name="NameType" >
> <xs:sequence>
> <xs:element name="Civility" type="CivilityT ype" />
> <xs:element name="First" type="xs:string " />
> <xs:element name="Last" type="xs:string " />
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> <!-- PERSON.XSD -->
> <xs:schema xmlns="http://copro/Copro.Persons"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace ="http://copro/Copro.Persons"
elementFormDefa ult="qualified"
> attributeFormDe fault="unqualif ied" id="PersonSpace ">
> <xs:include schemaLocation= "Common-Naming.xsd" />
> <xs:simpleTyp e name="FamillySt atus">
> <xs:restricti on base="xs:string ">
> <xs:enumerati on value="SINGLE" />
> <xs:enumerati on value="MARIED" />
> <xs:enumerati on value="WEADOW" />
> <xs:enumerati on value="UNDEFINE D" />
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleTyp e name="CommonSha redActivity">
> <xs:restricti on base="xs:string ">
> <xs:enumerati on value="Jardinag e" />
> <xs:enumerati on value="Musique" />
> <xs:enumerati on value="Informat ique" />
> <xs:enumerati on value="Baby-Sisting" />
> </xs:restriction>
> </xs:simpleType>
> <xs:complexTy pe name="PersonTyp e">
> <xs:complexCont ent>
> <xs:extension base="BusinessE ntityType">
> <xs:sequence>
> <xs:element name="Name" type="NameType" />
> <xs:element name="ArrivalDa te" type="xs:date"
> minOccurs="0" />
> <xs:element name="IsCoproMa nager" type="xs:boolea n" > default="false" minOccurs="0" />
> <xs:element name="FamillySt atus" type="FamillySt atus" > default="UNDEFI NED" minOccurs="0" />
> <xs:element name="BirthDay" type="xs:dateTi me"
> minOccurs="0" />
> <xs:element name="Email" type="xs:string "
minOccurs="0" />
> <xs:element name="SharedAct ivity" type="xs:string "
> minOccurs="0" maxOccurs="unbo unded" />
> </xs:sequence>
> </xs:extension>
> </xs:complexConte nt>
> </xs:complexType>
> <xs:complexTy pe name="PersonRef Type">
> <xs:complexCont ent>
> <xs:extension base="EntityRef Type">
> <xs:sequence>
> <xs:element ref="Person" minOccurs="0" />
> </xs:sequence>
> </xs:extension>
> </xs:complexConte nt>
> </xs:complexType>
> <xs:element name="Person" type="PersonTyp e">
> <xs:unique name="PersonByR eference">
> <xs:selector xpath="." />
> <xs:field xpath="Referenc e" />
> </xs:unique>
> </xs:element>
> </xs:schema>
> <!-- RESIDENT.XSD -->
> <xs:schema xmlns="http://copro/Copro.Residents "
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:p="http://copro/Copro.Persons"
> targetNamespace ="http://copro/Copro.Residents "
elementFormDefa ult="qualified"
> attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
> <xs:include schemaLocation= "Common.xsd "/>
> <xs:import namespace="http ://copro/Copro.Persons"
> schemaLocation= "Person.xsd "/>
> <xs:complexTy pe name="ResidentT ype">
> <xs:complexCont ent>
> <xs:extension base="BusinessE ntityType">
> <xs:sequence>
> <xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/>
> <xs:element name="Person" type="p:PersonR efType" maxOccurs="unbo unded"/> > <!--
> <xs:element ref="p:Person" maxOccurs="unbo unded"/>
> -->
> </xs:sequence>
> <xs:attribute name="copro" type="xs:string "/>
> </xs:extension>
> </xs:complexConte nt>
> </xs:complexType>
> <xs:element name="Resident" type="ResidentT ype"/>
> </xs:schema>
>
>


Nov 12 '05 #5
I had to tweak the path information in your program to make it work locally
but when I ran it, it did not produce any error, Here was the output:

Current dir: C:\tempTest\tem p
Current dir: C:\tempTest\tem p
loading: Resident.xsd
loaded: Resident.xsd
loaded schemas : 2
Compile done...

I am using later bits of the .net framework than you are using, and this
does not seem to be a problem anymore.

Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message
news:84******** *************** ***********@mic rosoft.com...
I would have send a zip if it was possible but i don't kown how to do it on a thread.
( i guess it's not possible.. ) so here is my little console program.

As i put all my XML-Schemas in the Console Project i reset the working "dir" first, otherwise you can't do more simple...

Thanks again for your help.

using System.Xml.Seri alization;

namespace Schema
{
class Program
{
private const string shemaName = @"Resident.xsd" ;

[STAThread]
static void Main( string[] args )
{
string currentDir = Directory.GetCu rrentDirectory( );
Console.WriteLi ne( "Current dir: {0}",
currentDir );
string path = Path.Combine( currentDir,
@"..\.." );
Directory.SetCu rrentDirectory( path);
currentDir = Directory.GetCu rrentDirectory( ); Console.WriteLi ne( "Current dir: {0}",
currentDir );
path = Path.Combine( currentDir, shemaName ); XmlSchema schema = null;
Console.WriteLi ne( "loading: " + shemaName ); using ( Stream stream = new FileStream( path, FileMode.Open, FileAccess.Read , FileShare.Read ) )
{
XmlReader xr = new XmlTextReader(
stream );
schema =
System.Xml.Sche ma.XmlSchema.Re ad( xr, null );
}
Console.WriteLi ne( "loaded: " + shemaName );
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add( schema );
Console.WriteLi ne( "loaded schemas : " +
schemaSet.Count );

try
{

schemaSet.Valid ationEventHandl er+=new ValidationEvent Handler(
schemaSet_Valid ationEventHandl er );
schemaSet.Compi le();
}
catch(Exception e )
{
Console.WriteLi ne( e.ToString());
}

if( schemaSet.IsCom piled )
Console.WriteLi ne( "Compile done..." );
else
Console.WriteLi ne( "Compile failed..." );

Console.Read();
}

static void schemaSet_Valid ationEventHandl er( object
sender, ValidationEvent Args e )
{
Console.WriteLi ne( e.Exception.ToS tring() );
throw new Exception( "Compile error",
e.Exception );
}
}
}
"Zafar Abbas" wrote:
Could you please share your code, so I could try it and let you know.
Thanks.
"Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in message news:2B******** *************** ***********@mic rosoft.com...
Hello,

Just for info i run the program again : here is the console output :

Current dir: D:\Projects\Cop ro\Copro.Schema s\bin\Debug
Current dir: D:\Projects\Cop ro\Copro.Schema s
loading: Resident.xsd
loaded: Resident.xsd
loaded schemas : 2
System.Xml.Sche ma.XmlSchemaExc eption: The attribute 'oid' already exists. System.Exceptio n: Compile error ---> System.Xml.Sche ma.XmlSchemaExc eption: The attribute 'oid' already exists.
--- End of inner exception stack trace ---
at Schema.Program. schemaSet_Valid ationEventHandl er(Object sender,
ValidationEvent Args e) in D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne
58
at

System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at

System.Xml.Sche ma.Compiler.Com pileLocalAttrib utes(XmlSchemaC omplexType
baseType, XmlSchemaComple xType derivedType, XmlSchemaObject Collection
attributes, XmlSchemaAnyAtt ribute anyAttribute,
XmlSchemaDeriva tionMethod derivedBy)
at System.Xml.Sche ma.Compiler.Com pileComplexType (XmlSchemaCompl exType complexType)
at System.Xml.Sche ma.Compiler.Com pile()
at System.Xml.Sche ma.Compiler.Exe cute(XmlSchemaS et schemaSet, Boolean compileContentM odel, SchemaInfo schemaCompiledI nfo)
at System.Xml.Sche ma.XmlSchemaSet .Compile()
at Schema.Program. Main(String[] args) in
D:\Projects\Cop ro\Copro.Schema s\Program.cs:li ne 40
Compile failed...

regards

"Zafar Abbas" wrote:

> I am able to save all 4 files as XSD schemas, and compile Residents.xsd > using the XmlSchemaSet without any problems.
> What version of the .net framework are you using and how does your code look
> like?
>
> Thanks.
>
>
> "Brice Prunier" <Br**********@d iscussions.micr osoft.com> wrote in

message
> news:1B******** *************** ***********@mic rosoft.com...
> > Here under 4 schemas i'm working with ( it may be long: sorry...)
> > The context is the following :
> > Resident.xsd imports Person.xsd and includes Common.xsd (

anonimous > schema:
> > no TargetNamespace )
> > Person.xsd includes Common-Naming.xsd ( anonimous schemas )
> > Common-Naming.xsd includes common.xsd ( both are anonimous schemas ) > >
> > Compilation of Resident.xsd raise the following exception:
> > "System.Xml.Sch ema.XmlSchemaEx ception: The attribute 'oid' already > > exists...."
> >
> > That is wrong : the schemas are valid and well done ( Xml-Spy ).
> >
> > The problem seems to be that Common.xsd appears twice: one time in
> > Resident.xsd and an other time in Person.xsd. i tried to put

Common.xsd &
> > Common-Naming.xsd in a same file it doesn't change anything.
> >
> > Thank for any help because i'm currently freezed in my dev....
> >
> > <!-- COMMON.XSD -->
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
> > id="CommonSpace ">
> > <xs:group name="IEntity">
> > <xs:sequence>
> > <xs:element name="Reference " type="xs:string "/>
> > </xs:sequence>
> > </xs:group>
> > <xs:complexTy pe name="BusinessE ntityType">
> > <xs:sequence>
> > <xs:group ref="IEntity"/>
> > </xs:sequence>
> > <xs:attributeGr oup ref="ISqlEntity "/>
> > </xs:complexType>
> > <xs:complexTy pe name="EntityRef Type">
> > <xs:sequence>
> > <xs:element name="Reference " type="xs:string "/>
> > <xs:element name="Descripti on" type="xs:string "/>
> > </xs:sequence>
> > <xs:attributeGr oup ref="ISqlEntity "/>
> > </xs:complexType>
> > <xs:complexTy pe name="RefType">
> > <xs:complexCont ent>
> > <xs:extension base="EntityRef Type">
> > <xs:attribute name="type" type="xs:string "/>
> > </xs:extension>
> > </xs:complexConte nt>
> > </xs:complexType>
> > <xs:attributeGr oup name="ISqlEntit y">
> > <xs:attribute name="oid" type="xs:string "/>
> > </xs:attributeGro up>
> > </xs:schema>
> > <!-- COMMON-NAMING.XSD -->
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied"
> > id="CommonNamin gSpace">
> > <xs:include schemaLocation= "Common.xsd " />
> > <xs:simpleTyp e name="SexeTypol ogy">
> > <xs:restricti on base="xs:string ">
> > <xs:enumerati on value="M" />
> > <xs:enumerati on value="F" />
> > </xs:restriction>
> > </xs:simpleType>
> > <xs:simpleTyp e name="CivilityT ypology">
> > <xs:restricti on base="xs:string ">
> > <xs:enumerati on value="c1:MRS" />
> > <xs:enumerati on value="c2:MISS" />
> > <xs:enumerati on value="c3:MR" />
> > <xs:enumerati on value="c4:DOC" />
> > <xs:enumerati on value="c5:PROF" />
> > </xs:restriction>
> > </xs:simpleType>
> > <xs:complexTy pe name="CivilityT ype">
> > <xs:simpleConte nt>
> > <xs:extension base="xs:string ">
> > <xs:attribute name="type" type="CivilityT ypology"
> > default="c3:MR" />
> > </xs:extension>
> > </xs:simpleConten t>
> > </xs:complexType>
> > <xs:complexTy pe name="NameType" >
> > <xs:sequence>
> > <xs:element name="Civility" type="CivilityT ype" />
> > <xs:element name="First" type="xs:string " />
> > <xs:element name="Last" type="xs:string " />
> > </xs:sequence>
> > </xs:complexType>
> > </xs:schema>
> > <!-- PERSON.XSD -->
> > <xs:schema xmlns="http://copro/Copro.Persons"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > targetNamespace ="http://copro/Copro.Persons"
> elementFormDefa ult="qualified"
> > attributeFormDe fault="unqualif ied" id="PersonSpace ">
> > <xs:include schemaLocation= "Common-Naming.xsd" />
> > <xs:simpleTyp e name="FamillySt atus">
> > <xs:restricti on base="xs:string ">
> > <xs:enumerati on value="SINGLE" />
> > <xs:enumerati on value="MARIED" />
> > <xs:enumerati on value="WEADOW" />
> > <xs:enumerati on value="UNDEFINE D" />
> > </xs:restriction>
> > </xs:simpleType>
> > <xs:simpleTyp e name="CommonSha redActivity">
> > <xs:restricti on base="xs:string ">
> > <xs:enumerati on value="Jardinag e" />
> > <xs:enumerati on value="Musique" />
> > <xs:enumerati on value="Informat ique" />
> > <xs:enumerati on value="Baby-Sisting" />
> > </xs:restriction>
> > </xs:simpleType>
> > <xs:complexTy pe name="PersonTyp e">
> > <xs:complexCont ent>
> > <xs:extension base="BusinessE ntityType">
> > <xs:sequence>
> > <xs:element name="Name" type="NameType" />
> > <xs:element name="ArrivalDa te" type="xs:date"
> > minOccurs="0" />
> > <xs:element name="IsCoproMa nager"

type="xs:boolea n"
> > default="false" minOccurs="0" />
> > <xs:element name="FamillySt atus"

type="FamillySt atus"
> > default="UNDEFI NED" minOccurs="0" />
> > <xs:element name="BirthDay" type="xs:dateTi me"
> > minOccurs="0" />
> > <xs:element name="Email" type="xs:string "
> minOccurs="0" />
> > <xs:element name="SharedAct ivity" type="xs:string " > > minOccurs="0" maxOccurs="unbo unded" />
> > </xs:sequence>
> > </xs:extension>
> > </xs:complexConte nt>
> > </xs:complexType>
> > <xs:complexTy pe name="PersonRef Type">
> > <xs:complexCont ent>
> > <xs:extension base="EntityRef Type">
> > <xs:sequence>
> > <xs:element ref="Person" minOccurs="0" />
> > </xs:sequence>
> > </xs:extension>
> > </xs:complexConte nt>
> > </xs:complexType>
> > <xs:element name="Person" type="PersonTyp e">
> > <xs:unique name="PersonByR eference">
> > <xs:selector xpath="." />
> > <xs:field xpath="Referenc e" />
> > </xs:unique>
> > </xs:element>
> > </xs:schema>
> > <!-- RESIDENT.XSD -->
> > <xs:schema xmlns="http://copro/Copro.Residents "
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:p="http://copro/Copro.Persons"
> > targetNamespace ="http://copro/Copro.Residents "
> elementFormDefa ult="qualified"
> > attributeFormDe fault="unqualif ied" id="ResidentSpa ce">
> > <xs:include schemaLocation= "Common.xsd "/>
> > <xs:import namespace="http ://copro/Copro.Persons"
> > schemaLocation= "Person.xsd "/>
> > <xs:complexTy pe name="ResidentT ype">
> > <xs:complexCont ent>
> > <xs:extension base="BusinessE ntityType">
> > <xs:sequence>
> > <xs:element name="Copro-Item" type="RefType" maxOccurs="unbo unded"/> > > <xs:element name="Person" type="p:PersonR efType"

maxOccurs="unbo unded"/>
> > <!--
> > <xs:element ref="p:Person" maxOccurs="unbo unded"/>
> > -->
> > </xs:sequence>
> > <xs:attribute name="copro" type="xs:string "/>
> > </xs:extension>
> > </xs:complexConte nt>
> > </xs:complexType>
> > <xs:element name="Resident" type="ResidentT ype"/>
> > </xs:schema>
> >
> >
>
>
>


Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3328
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new rightType;
10
19710
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I have a struct that contains several different types of data. This struct is used throuout the program. Now, when I compile, I get 6 errors, all of them "Use of possibly unassigned field 'awayTime'" or "Use of possibly unassigned field 'intlTime'"....
6
2851
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked fine while the file was in the project directory. When the obsolete file was removed from the project directory, my application will no longer compile. Can someone please help with this issue? Thank in advance, Tom
3
7576
by: sachinvyas | last post by:
Hi, I have following schema saved in new.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://www.smpte-ra.org/schemas/429.7/2006/CPL" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:cpl="http://www.smpte-ra.org/schemas/429.7/2006/CPL"
9
3509
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them has mandatory parameters, I mean, they should not be null nor empty (for strings). So I'd make the validation in the constructor and generate a compile-time error if the validation does not match... Is there a way to achieve this or to specify...
4
1839
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following: C:\PK\Development\Products\UTCAS\4.0\SRC\MeltPracApplication\Dialog\Composit ionForm.cs(942): Argument '1': cannot convert from 'ref MeltPracData.MeltPracDataComposition' to 'ref MeltPracCommon.IDialogPostData'
1
4186
by: =?Utf-8?B?Q2hyaXN0b3BoZXI=?= | last post by:
Hello, Using .NET 2.0 and the System.XML.Schema.XMLSchema class. I am adding some schemas into the XMLSchemaSet object using XmlSchemaSet.Add. The schemas I am adding have circular imports, and therefore I have implimented a custom XMLResolver class to help filter out duplicate schemas. Now my questions: 1. If a schema I add has other schema imports they are sent to the ResolveUri Override function. If any of these schemas already exist I...
1
4021
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that XmlSchema.Write() is changing <xsd:element minOccurs="1" name="AccountId" type="s-xsd:primarykey" /> to be
2
4135
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error message is: E:\software\development\boost_1_35_0\boost_1_35_0>bjam -- toolset=msvc-7.1 --variant=release --threading=multi --link=shared --
0
8608
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9086
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8806
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5820
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4324
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2241
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1959
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.