Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Schema help

Status
Not open for further replies.

sirrahhc

Programmer
Feb 15, 2005
9
US
Hey guys whats up??...I am working on a schema to map in xml files to SQL tables. I have a VB script that loads the files into a DB based off of the schema. The tables loaded are Vendor, Placement, Patient, Facility, Summary and Comment. I had the schema working and loading nicely but I missed 1 table, "Services". I went back to work on the schema and add in this table but now cannot get it to work right. I am getting the following long error when I try to run my VB script:

Schema: unable to load schema_v2.xsd. An error occured (schema_V2.xsd#/schema[1]/element[position()=1 and @name = Data]/complextype[1]/sequence[1]/element[position()=3 and @name=Vendor]/complextype[1]/sequence[1]/element[position()=5 and @name = Placement]/complextype[1]/sequence[1]/element[position()=8 and @name = Services]
In the same scope elements with the same name, Services have to be the same type
Error Code 80004005

...has anyone ever seen an error like this??

...I've attached my schema for anyone to review who's interested...I can also provide the schema that I had working if needed, just let me know...thanks for any help in advance!!!
 
i guess I cannot attach...here is the schema...


<?xml version="3.0" standalone="no"?>
<xs:schema xmlns:xs=" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">

<xs:annotation>
<xs:appinfo>
<sql:relationship name="VenPlace"
parent="Vendor"
parent-key="Confirmed_Id"
child="Placement"
child-key="Confirmed_Id" />
</xs:appinfo>
</xs:annotation>

<xs:annotation>
<xs:appinfo>
<sql:relationship name="PlacePatient"
parent="Placement"
parent-key="Confirmed_Id"
child="Patient"
child-key="Confirmed_Id" />
</xs:appinfo>
</xs:annotation>

<xs:annotation>
<xs:appinfo>
<sql:relationship name="VenComment"
parent="Vendor"
parent-key="Confirmed_Id"
child="Comment"
child-key="Confirmed_Id" />
</xs:appinfo>
</xs:annotation>

<xs:annotation>
<xs:appinfo>
<sql:relationship name="PlacePat"
parent="Placement"
parent-key="Pat_Mem_Num"
child="Patient"
child-key="Mem_Num" />
</xs:appinfo>
</xs:annotation>

<xs:annotation>
<xs:appinfo>
<sql:relationship name="PlaceServ"
parent="Placement"
parent-key="Aoplc_Num"
child="Service"
child-key="Aoplc_Num" />
</xs:appinfo>
</xs:annotation>

<xs:annotation>
<xs:appinfo>
<sql:relationship name="PlaceCom"
parent="Placement"
parent-key="Aoplc_Num"
child="Comment"
child-key="Aoplc_Num" />
</xs:appinfo>
</xs:annotation>

<xs:element name="Data" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Summary" sql:relation="Summary">
<xs:complexType>
<xs:sequence>
<xs:element name="Count_AhCmt_Num" type="xs:integer"/>
<xs:element name="Count_AhSvc_Num" type="xs:integer"/>
<xs:element name="Sum_Svc_Amt" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Facility" sql:relation="Facility">
<xs:complexType>
<xs:sequence>
<xs:element name="Descr" type="xs:string"/>
<xs:element name="Hosp_Id" type="xs:string"/>
<xs:element name="Fac_Cd" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Vendor" sql:relation="Vendor">
<xs:complexType>
<xs:sequence>
<xs:element name="Confirmed_Id" type="xs:string"/>
<xs:element name="Holding_Id" type="xs:string"/>
<xs:element name="Vnd_Cd" type="xs:string"/>
<xs:element name="Vnd_Num" type="xs:string"/>
<xs:element name="Placement" sql:relation="Placement" sql:relationship="VenPlace">
<xs:complexType>
<xs:sequence>
<xs:element name="Confirmed_Id" type="xs:string"/>
<xs:element name="Aoplc_Num" type="xs:string"/>
<xs:element name="Bal_Amt" type="xs:decimal"/>
<xs:element name="Pat_Acct_Num" type="xs:string"/>
<xs:element name="Pat_Mem_Num" type="xs:string"/>
<xs:element name="Services" type="xs:string"/>
<xs:element name="Patient" sql:relation="Patient" sql:relationship="PlacePat">
<xs:complexType>
<xs:sequence>
<xs:element name="Confirmed_Id" type="xs:string"/>
<xs:element name="Mem_Num" type="xs:string"/>
<xs:element name="Lnm" type="xs:string"/>
<xs:element name="Fnm" type="xs:string"/>
<xs:element name="Mi" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Services" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Service" sql:relation="Service" sql:relationship="PlaceServ">
<xs:complexType>
<xs:sequence>
<xs:element name="Ahsvc_Num" type="xs:string"/>
<xs:element name="Aoplc_Num" type="xs:string"/>
<xs:element name="Svc_Cd" type="xs:string"/>
<xs:element name="Svc_Chg" type="xs:decimal"/>
<xs:element name="Post_Dt" type="xs:string"/>
<xs:element name="Typ_Cd" type="xs:string"/>
<xs:element name="Pay_Responsible_Cd" type="xs:string"/>
<xs:element name="Descr" type="xs:string"/>
<xs:element name="Ipt_Batch_Num" type="xs:string"/>
<xs:element name="Add_User_Id" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Comments" sql:is-constant="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Comment" sql:relation="Comment" sql:relationship="PlaceCom">
<xs:complexType>
<xs:sequence>
<xs:element name="Confirmed_Id" type="xs:string"/>
<xs:element name="Ahcmt_Num" type="xs:string"/>
<xs:element name="Aoplc_Num" type="xs:string"/>
<xs:element name="Svc_Cd" type="xs:string"/>
<xs:element name="Svc_Dt" type="xs:string"/>
<xs:element name="Post_Dt" type="xs:string"/>
<xs:element name="Descr" type="xs:string"/>
<xs:element name="Ipt_Batch_Num" type="xs:string"/>
<xs:element name="Add_User_Id" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
 
>In the same scope elements with the same name, Services have to be the same type
That precisely means that within the same scope (within the element named "Placement", you have two elements both named "Services", one is of simpleType (xs:string) and the other is of a complexType, as defined in a couple of lines below the previous one.
 
hey thanks...I finally got back to this and worked it out...i removed one of each: </xs:element> & </xs:sequence>

...after the "Service" bit and it worked great...thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top