Can someone help me with my xml mapping schema?

hydaySinenich

New Member
I am fairly new to xml mapping schema so this may seems easy for you but I have been searching a lot but cannot figure out the issue.I am trying to create a xml mapping schema to bulkload xml data into sql server database. \[code\] SQLXMLBULKLOADLib.SQLXMLBulkLoad4 objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4(); objBL.ConnectionString = "Provider=sqloledb;server=server;database=myDB;integrated security=SSPI"; objBL.ErrorLogFile = "error.xml"; objBL.KeepIdentity = false; objBL.Execute("C:\\Paper_Listing.xsd", "c:\\Paper_Listing.xml");\[/code\]the Paper_Listing.xml is quite straightforward.\[code\] <?xml version="1.0" encoding="utf-8" ?> <Sync report="Sync - Bravura_Paper_Listing"> <data> <row disposition="INSERT"> <Key_PaperID>45454</Key_PaperID> <Order>1</Order> <PaperEndTime>12:15 AM</PaperEndTime> <PaperNumber /> <PaperStartTime>12:00 AM</PaperStartTime> <PaperTitle>The origin and function of langerin+ cells in mice and humans</PaperTitle> <SessionID>3831</SessionID> </row> <row disposition="INSERT"> <Key_PaperID>45457</Key_PaperID> <Order>2</Order> <PaperEndTime>12:30 AM</PaperEndTime> <PaperNumber /> <PaperStartTime>12:15 AM</PaperStartTime> <PaperTitle>LCH: Back to Histiocytosis X</PaperTitle> <SessionID>3831</SessionID> </row> <row disposition="INSERT"> <Key_PaperID>45461</Key_PaperID> <Order>3</Order> <PaperEndTime>12:45 AM</PaperEndTime> <PaperNumber /> <PaperStartTime>12:30 AM</PaperStartTime> <PaperTitle>HLH - Biology and SCT</PaperTitle> <SessionID>3831</SessionID> </row> </data> <snapshotid>658455959c0a06be9db726924c81cff7</snapshotid> </Sync>\[/code\]The Paper_List.xsd schema I created based on the research I did is the following:\[code\]<?xml version="1.0" encoding="utf-8"?><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema" ><xs:element name="Sync" sql:mapped="false"> <xs:complexType> <xs:sequence> <xs:element name="data" sql:mapped="false"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="row" sql:relation="Paper_List"> <xs:complexType> <xs:attribute name="Key_PaperID" type="xs:unsignedShort" sql:field="Paper_ID"/> <xs:attribute name="Order" type="xs:unsignedByte" sql:field="Order"/> <xs:attribute name="PaperEndTime" type="xs:string" sql:field="PaperEndTime"/> <xs:attribute name="PaperNumber" sql:field="PaperNumber"/> <xs:attribute name="PaperStartTime" type="xs:string" sql:field="PaperStartTime"/> <xs:attribute name="PaperTitle" type="xs:string" sql:field="PaperTitle"/> <xs:attribute name="SessionID" type="xs:unsignedShort" sql:field="SessionID"/> <xs:attribute name="disposition" type="xs:string" use="required" sql:field="Disposition"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="snapshotid" type="xs:string" /> </xs:sequence> <xs:attribute name="report" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:schema>\[/code\]The table in database that I will load data into is "Paper_List" with (Key_PaperID,Order,PaperEndTime,PaperNumber,PaperStartTime,PaperTitle,SessionID,Disposition) as the columns.When I run the bulkload.execute method, I kept getting "Schema: relationship expected on 'data'." error.Can someone point me where I did wrong? Thanks a lot.
 
Back
Top