Hello,
I have a very simple xml file that I am reading into a DataSet using VB.NET. The problem I am having is setting my own unique IDs for the elements. After creating a DataSet of the below XML, a new column is added to each table. In this case Product_ID is not used, but a new column of Product_ID_0 is used. From what I have read I need to use DTD to set this. I tried it as follows and no luck. I would appreciate any help.
Thank you!
I have a very simple xml file that I am reading into a DataSet using VB.NET. The problem I am having is setting my own unique IDs for the elements. After creating a DataSet of the below XML, a new column is added to each table. In this case Product_ID is not used, but a new column of Product_ID_0 is used. From what I have read I need to use DTD to set this. I tried it as follows and no luck. I would appreciate any help.
Thank you!
Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE Products [ <!ELEMENT Products ( Product+ ) > <!ELEMENT Product ( Quantity, ItemNumber, Prompts+ ) > <!ELEMENT Quantity (#PCDATA ) > <!ELEMENT ItemNumber ( #PCDATA ) > <!ATTLIST Product Name CDATA #REQUIRED> <!ATTLIST Product Product_ID ID #REQUIRED> <!ELEMENT Prompts ( Prompt+ ) > <!ATTLIST Prompt Prompts_ID ID #REQUIRED> <!ATTLIST Prompt Product_ID IDREF #REQUIRED> <!ATTLIST Prompt Name CDATA #REQUIRED> <!ATTLIST Prompt Value CDATA #REQUIRED> ]> <Products> <Product Name="Product One" Product_ID="1"> <Quantity>2</Quantity> <ItemNumber>1.00</ItemNumber> <Prompts> <Prompt Prompts_ID="1" Product_ID="1" Name="Finish" Value="Yes" /> <Prompt Prompts_ID="2" Product_ID="1" Name="Color" Value="Red" /> </Prompts> </Product> <Product Name="Product Two" Product_ID="2"> <Quantity>2</Quantity> <ItemNumber>2.00</ItemNumber> <Prompts> <Prompt Prompts_ID="3" Product_ID="2" Name="Finish" Value="Yes" /> <Prompt Prompts_ID="4" Product_ID="2" Name="Color" Value="Red" /> </Prompts> </Product> </Products>
Comment