C# read cXML and Insert into SQL Table and generate cXML from SQL Table

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi Experts,
Im quiet new to cXML technology. we have requirement to read cXML from supplier and insert all the data to relevant fields in SQL Table.
Could anyone please suggest me with whats the best way to :
<blockquote>
<ol>
Read cXML document. Insert the cXML document elements and attributes to required fields in sql table.
Once processed read back the table and generate another cXML. </ol>
</blockquote>
Below is the sample cXML:

<pre>
Code:
<span><Header><br/><From><br/><Credential domain="AribaNetworkUserId <br/><Identity>admin@acme.com</Identity><br/></Credential><br/></From><br/><To><br/><Credential domain="DUNS <br/><Identity>012345678</Identity><br/></Credential><br/></To><br/><Sender><br/><Credential domain="AribaNetworkUserId <br/><Identity>sysadmin@buyer.com</Identity><br/><SharedSecret>abracadabra</SharedSecret><br/></Credential><br/><UserAgent>Network Hub 1.1</UserAgent><br/></Sender><br/></Header><br/><Request><span><br/><span><OrderRequest><span><br/>  <span><OrderRequestHeader<span> <span>orderID<span>=<span>"xy1234"<span> <span>orderDate<span>=<span>"2007-01-1T15:5400+10:00"<span> <span>type<span>=<span>"new"<span> <span>orderVersion<span>=<span>"001"<span>><span><br/>    <span><Total><span><br/>      <span><Money<span> <span>currency<span>=<span>"NZ"<span>><span>34.06<span></Money><span><br/>    <span></Total><span><br/>    <span><ShipTo><span><br/>      <span><Address><span><br/>        <span><Name<span> <span>xml:lang<span>=<span>"en"<span>><span>xyz<span></Name><span><br/>        <span><PostalAddress<span> <span>name<span>=<span>"xyz"<span>><span><br/>          <span><Street><span>xyz street<span></Street><span><br/>          <span><City><span>xyz<span></City><span>              <br/>        <span></PostalAddress><span><br/>      <span></Address><span><br/>    <span></ShipTo><span><br/>    <span><BillTo><span><br/>      <span><Address><span><br/>        <span><Name<span> <span>xml:lang<span>=<span>"en"<span>><span>XYZ<span></Name><span><br/>        <span><PostalAddress<span> <span>name<span>=<span>"XYZ"<span>><span><br/>          <span><Street><span>PO BOX 1234<span></Street><span><br/>          <span><City><span>xyz<span></City><span><br/>          <span><State><span>xyz state<span></State><span>              <br/>        <span></PostalAddress><span><br/>      <span></Address><span><br/>    <span></BillTo><span><br/>    <span><Contact<span> <span>role<span>=<span>"xxx"<span> <span>addressID<span>=<span>"123456789"<span>><span><br/>      <span><Name<span> <span>xml:lang<span>=<span>"en"<span>><span>XYZ<span></Name><span><br/>      <span><Email<span> <span>name<span>=<span>"business"<span>><span>XYZ@ms.com.nz<span></Email><span><br/>      <span><Phone><span><br/>        <span><TelephoneNumber><span><br/>          <span><Number><span>1234-1234<span></Number><span><br/>        <span></TelephoneNumber><span><br/>      <span></Phone><span><br/>    <span></Contact><span><br/>    <span><Contact<span> <span>role<span>=<span>"ShipTo"<span>><span><br/>      <span><Name<span> <span>xml:lang<span>=<span>"en"<span>><span>XYZ<span></Name><span><br/>    <span></Contact><span><br/>    <span><Contact<span> <span>role<span>=<span>"Supplier"<span>><span><br/>      <span><Name<span> <span>xml:lang<span>=<span>"en"<span>><span>XYZ pty ltd<span></Name><span><br/>    <span></Contact><span><br/>  <span></OrderRequestHeader><span><br/>  <span><ItemOut<span> <span>quantity<span>=<span>"20"<span> <span>lineNumber<span>=<span>"1"<span> <span>requestedDeliveryDate<span>=<span>"2007-01-01T00:0000+10:00"<span>><span><br/>    <span><ItemID><span><br/>      <span><SupplierPartID><span>12345678<span></SupplierPartID><span><br/>    <span></ItemID><span><br/>    <span><ItemDetail><span><br/>      <span><UnitPrice><span><br/>        <span><Money<span> <span>currency<span>=<span>"NZ"<span>><span>32<span></Money><span><br/>      <span></UnitPrice><span><br/>      <span><Description<span> <span>xml:lang<span>=<span>"en"<span>><span>abc description<span></Description><span><br/>      <span><UnitOfMeasure><span>CU<span></UnitOfMeasure><span><br/>      <span><Classification<span> <span>domain<span>=<span>"N/A"<span>/><span><br/>      <span><ManufacturerPartID><span>12345678<span></ManufacturerPartID><span><br/>      <span><Extrinsic<span> <span>name<span>=<span>"StockCode"<span>><span>12345<span></Extrinsic><span><br/>      <span><Extrinsic<span> <span>name<span>=<span>"Quantity"<span>><span>1<span></Extrinsic><span>          <br/>    <span></ItemDetail><span><br/>  <span></ItemOut><span><br/>  <span><ItemOut<span> <span>quantity<span>=<span>"10"<span> <span>lineNumber<span>=<span>"2"<span> <span>requestedDeliveryDate<span>=<span>"2007-01-01T00:0000+10:00"<span>><span><br/>    <span><ItemID><span><br/>      <span><SupplierPartID><span>12345678<span></SupplierPartID><span><br/>    <span></ItemID><span><br/>    <span><ItemDetail><span><br/>      <span><UnitPrice><span><br/>        <span><Money<span> <span>currency<span>=<span>"NZ"<span>><span>32<span></Money><span><br/>      <span></UnitPrice><span><br/>      <span><Description<span> <span>xml:lang<span>=<span>"en"<span>><span>abc description<span></Description><span><br/>      <span><UnitOfMeasure><span>CU<span></UnitOfMeasure><span><br/>      <span><Classification<span> <span>domain<span>=<span>"N/A"<span>/><span><br/>      <span><ManufacturerPartID><span>12345678<span></ManufacturerPartID><span><br/>      <span><Extrinsic<span> <span>name<span>=<span>"StockCode"<span>><span>23333<span></Extrinsic><span><br/>      <span><Extrinsic<span> <span>name<span>=<span>"Quantity"<span>><span>1<span></Extrinsic><span><br/>    <span></ItemDetail><span><br/>  <span></ItemOut><span><br/><span></OrderRequest><span><br/>
[/code]

View the full article
 
Back
Top