473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XML to DataSet Unique ID

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!

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <!DOCTYPE Products [
  5. <!ELEMENT Products ( Product+ ) >
  6. <!ELEMENT Product ( Quantity, ItemNumber, Prompts+ ) >
  7. <!ELEMENT Quantity (#PCDATA ) >
  8. <!ELEMENT ItemNumber ( #PCDATA ) >
  9. <!ATTLIST Product Name CDATA #REQUIRED>
  10. <!ATTLIST Product Product_ID ID #REQUIRED>
  11. <!ELEMENT Prompts ( Prompt+ ) >
  12. <!ATTLIST Prompt Prompts_ID ID #REQUIRED>
  13. <!ATTLIST Prompt Product_ID IDREF #REQUIRED>
  14. <!ATTLIST Prompt Name CDATA #REQUIRED>
  15. <!ATTLIST Prompt Value CDATA #REQUIRED>
  16. ]>
  17.  
  18. <Products>
  19.   <Product Name="Product One" Product_ID="1">
  20.     <Quantity>2</Quantity>
  21.     <ItemNumber>1.00</ItemNumber>
  22.     <Prompts>
  23.       <Prompt Prompts_ID="1" Product_ID="1" Name="Finish" Value="Yes" />
  24.       <Prompt Prompts_ID="2" Product_ID="1" Name="Color" Value="Red" />
  25.     </Prompts>
  26.   </Product>
  27.   <Product Name="Product Two" Product_ID="2">
  28.     <Quantity>2</Quantity>
  29.     <ItemNumber>2.00</ItemNumber>
  30.     <Prompts>
  31.       <Prompt Prompts_ID="3" Product_ID="2" Name="Finish" Value="Yes" />
  32.       <Prompt Prompts_ID="4" Product_ID="2" Name="Color" Value="Red" />
  33.     </Prompts>
  34.   </Product>
  35. </Products>
  36.  
  37.  
Apr 27 '09 #1
3 3296
Dormilich
8,658 Expert Mod 8TB
a DTD is used to verify whether an XML file conformes to a schema (i.e. if you execute a validating function you get either true or false as result). not more, not less.
Apr 28 '09 #2
Thank you for the response. I guess I misunderstood DTD. How would I set up an XML so that I can specify the ID?
Apr 28 '09 #3
Dormilich
8,658 Expert Mod 8TB
XML (used to store data) itself can't do that (except XSLT, which is a kind of programming language). You need the script that creates the XML (VB.NET) to take care of that.

nevertheless, you can use a DTD to verify that the script did use unique IDs.
Apr 28 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
1
by: tom | last post by:
hello, i have seen multiple postings on the subject but no answer that addresses my question: I create a dataset using a xsd schema. the schema specifies a relation from one of the tables to...
0
by: nima | last post by:
Hi I have two tables in my database. PRODUCT and PRODUCT_GROUP. PRODUCT has a foreign key to PRODUCT_GROUP. I generated a typed dataset using VS.net and added a relationship between the two...
7
by: Brian Keating | last post by:
Hi there, Is it possible to add a unique constraint on two columns in a table, so that the constraint is a composite of the two? i.e. these two columns together should be unique...? i.e....
2
by: SMG | last post by:
Hi there, We have a DataSet with one datatable with three columns and multiple rows. 1st Column : Unique Key 2nd Column : Value to Change 3rd Column : Value to Change Based on some...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
9
by: Mr Newbie | last post by:
HI People, Thanks to all who helped me earlier on the subject of @@IDentity. However, I seem to have hit another snagette! My DataSet contains two tables from the SQL Server. lets say Master...
2
by: Joe | last post by:
Hi I am going to receive a dataset downstream and I will not know the the fields number of field relations number of relations So I have to be flexible to take unknown data and be able to...
0
by: Joe | last post by:
Hi Could someone give me a simple explaination of this XSD which is a DataSet with relations The tables are fgFAT,e0,e1,e2,e3 which I have deleted I am trying to make sense of the part below...
5
by: Monty M. | last post by:
Hello; I was wondering if anyone can assist me with this problem. Here are the tools I am using: Language: C# Database: MS SQL Server 2000 Application: Visual Studio 2005 1. I have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.