473,581 Members | 2,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't duplicate any field names in XML?

Given an XML file (dataset.writex ml), here is my output (simplified for this
posting):

<?xml version="1.0" standalone="yes "?>
<NewDataSet>
<Category>
<CategoryId>8 0</CategoryId>
<Category>MyCat </Category>
</Category>
</NewDataSet>

But when I debug the field names, I see that my app is tweaking the field
names, apparently because they are dupes (?).

?ds.Tables(0).T ableName
"Category"
?ds.Tables(0).C olumns(0).Colum nName
"CategoryId "
?ds.Tables(0).C olumns(1).Colum nName
"Category_I d"

Am I not allowed to duplicate field and/or table names?

Looks like because my table is named "Category", that I can't also have
field named "Category".

If so, then I can't have an easy translation from SQL Server (PK/FK similar
field names) to XML. I guess I have to tweak my field names before writing
to XML? How should I go about doing this, or am I getting something wrong.

Thx.
May 26 '07 #1
4 1603
<-wrote in message news:eY******** ********@TK2MSF TNGP06.phx.gbl. ..
Given an XML file (dataset.writex ml), here is my output (simplified for
this posting):

<?xml version="1.0" standalone="yes "?>
<NewDataSet>
<Category>
<CategoryId>8 0</CategoryId>
<Category>MyCat </Category>
</Category>
</NewDataSet>

But when I debug the field names, I see that my app is tweaking the field
names, apparently because they are dupes (?).

?ds.Tables(0).T ableName
"Category"
?ds.Tables(0).C olumns(0).Colum nName
"CategoryId "
?ds.Tables(0).C olumns(1).Colum nName
"Category_I d"

Am I not allowed to duplicate field and/or table names?

Looks like because my table is named "Category", that I can't also have
field named "Category".

If so, then I can't have an easy translation from SQL Server (PK/FK
similar field names) to XML. I guess I have to tweak my field names before
writing to XML? How should I go about doing this, or am I getting
something wrong.
I'd say that what you got "wrong" is that you misuse the concept of a name.
I always say to name a thing for what it is, which implies that things with
the same name should be the same thing. Clearly, your "Category" field is
not the same as your "Category" table. Perhaps your "Category" field would
better be named "CategoryNa me". It will presumably be a unique field.
--
John Saunders [MVP]
May 27 '07 #2
In a relational database, it's not uncommon to name an attribute the same as
the entity when applied to the physical world.

Category, which is an entity, has a similarly-named attrbute.

CATEGORY
CategoryID
Category

This concept, in the XML world, fails, right?

I'm asking for supporting evidence from people who know better than my
cursory experience, which seems to suggest that.

That you attacked my physical implementation doesn't address my question,
nor does it seem to get around the fact that this appears to be a strong
limitation to XML. Unless there's a way around that. If so, I'd like to know
how.

Also, you don't know that I'm responsible to create the database. For all
you know, someone else may have implemented this, and I'm just working
around that. Either way, you have decided to attack me.

MVP? What does that stand for? Most Vile Pinhead?

(No offense intended to other MVPs who go out of their way to help people.
Guess you're just having a bad day).
"John Saunders [MVP]" <john.saunder s at trizetto.comwro te in message
news:eX******** ******@TK2MSFTN GP03.phx.gbl...
<-wrote in message news:eY******** ********@TK2MSF TNGP06.phx.gbl. ..
>Given an XML file (dataset.writex ml), here is my output (simplified for
this posting):

<?xml version="1.0" standalone="yes "?>
<NewDataSet>
<Category>
<CategoryId>8 0</CategoryId>
<Category>MyCat </Category>
</Category>
</NewDataSet>

But when I debug the field names, I see that my app is tweaking the field
names, apparently because they are dupes (?).

?ds.Tables(0). TableName
"Category"
?ds.Tables(0). Columns(0).Colu mnName
"CategoryId "
?ds.Tables(0). Columns(1).Colu mnName
"Category_Id "

Am I not allowed to duplicate field and/or table names?

Looks like because my table is named "Category", that I can't also have
field named "Category".

If so, then I can't have an easy translation from SQL Server (PK/FK
similar field names) to XML. I guess I have to tweak my field names
before writing to XML? How should I go about doing this, or am I getting
something wrong.

I'd say that what you got "wrong" is that you misuse the concept of a
name. I always say to name a thing for what it is, which implies that
things with the same name should be the same thing. Clearly, your
"Category" field is not the same as your "Category" table. Perhaps your
"Category" field would better be named "CategoryNa me". It will presumably
be a unique field.
--
John Saunders [MVP]


May 27 '07 #3
<-wrote in message news:eq******** ******@TK2MSFTN GP02.phx.gbl...
In a relational database, it's not uncommon to name an attribute the same
as the entity when applied to the physical world.

Category, which is an entity, has a similarly-named attrbute.

CATEGORY
CategoryID
Category

This concept, in the XML world, fails, right?

I'm asking for supporting evidence from people who know better than my
cursory experience, which seems to suggest that.

That you attacked my physical implementation doesn't address my question,
nor does it seem to get around the fact that this appears to be a strong
limitation to XML. Unless there's a way around that. If so, I'd like to
know how.

Also, you don't know that I'm responsible to create the database. For all
you know, someone else may have implemented this, and I'm just working
around that. Either way, you have decided to attack me.

MVP? What does that stand for? Most Vile Pinhead?

(No offense intended to other MVPs who go out of their way to help people.
Guess you're just having a bad day).
You asked me what you had gotten "wrong", so I put my reply in those terms.
I'm aware that occasionally the entity is named the same as a piece of it -
I've done database work since before relational databases - and I stick to
my contention that two things should have the same name only if they are the
same thing. And the attribute isn't "similarly-named", it is identically
named, suggesting that it is (impossibly) the identical thing.

I _do_ prefer to distinguish between the entity, it's primary key (ID), a
textual equivalent to the primary key (Name) and a textual description. If
the naming were left to me, there would be a Category table, with CategoryID
as its primary key, with CategoryName as a unique field, and with
CategoryDescrip tion as a non-unique, longer text description. This would
make all of the relationships clear, instead of saving four characters in a
column name by omitting "Name".

I responded with such a "philosophi cal" or "stylistic" response because I
believe that your practical problem is related to the stylistic one - in the
same way as the naming of this database would confuse human readers, I
believe that you have confused the software! Both problems would be
alleviated by giving a distinct name to the entity and to each of its
fields.

Now, you've got a very similar problem in your XML. It seems that you want
to have one element named "Category" which is of a complex type containing a
CategoryID and a Category, yet that second Category is meant to be of a
different type that the root "Category". Again, this is the result of giving
the same name to different things, and will only cause trouble. In this
case, you would need to convince software that, although these two elements
have the same name, they are actually unrelated (except for the name). Why,
for instance, should software not expect the following XML:

<Category>
<CategoryID>1 </CategoryID>
<Category>
<CategoryID>2 </Category>
<Category>... .

So, frankly, it's not a problem with the XML world, nor a benefit that the
relational world has - it's just a matter of the fact that the naming
convention you were using (whether or not you are responsible for creating
it) is confusing to both humans and to software. Correcting the naming issue
would solve the problem both for humans and for XML, and would prevent this
from becoming a problem with the next piece of software which assumes that
names mean something.
--
John Saunders [MVP]

P.S. Personally, I would have saved the word "vile" for something a lot
worse than my answer to you, but I suppose that's a matter of taste.
May 27 '07 #4
KJ
XML names are case-sensitive, so CATEGORY is not the same as Category.
Simply change the column aliases in your SELECT statements to something
unique -- the aliases will become the XML names and your collisions will be
resolved.

<-wrote in message news:eq******** ******@TK2MSFTN GP02.phx.gbl...
In a relational database, it's not uncommon to name an attribute the same
as the entity when applied to the physical world.

Category, which is an entity, has a similarly-named attrbute.

CATEGORY
CategoryID
Category

This concept, in the XML world, fails, right?

I'm asking for supporting evidence from people who know better than my
cursory experience, which seems to suggest that.

That you attacked my physical implementation doesn't address my question,
nor does it seem to get around the fact that this appears to be a strong
limitation to XML. Unless there's a way around that. If so, I'd like to
know how.

Also, you don't know that I'm responsible to create the database. For all
you know, someone else may have implemented this, and I'm just working
around that. Either way, you have decided to attack me.

MVP? What does that stand for? Most Vile Pinhead?

(No offense intended to other MVPs who go out of their way to help people.
Guess you're just having a bad day).
"John Saunders [MVP]" <john.saunder s at trizetto.comwro te in message
news:eX******** ******@TK2MSFTN GP03.phx.gbl...
><-wrote in message news:eY******** ********@TK2MSF TNGP06.phx.gbl. ..
>>Given an XML file (dataset.writex ml), here is my output (simplified for
this posting):

<?xml version="1.0" standalone="yes "?>
<NewDataSet >
<Category>
<CategoryId>8 0</CategoryId>
<Category>MyCat </Category>
</Category>
</NewDataSet>

But when I debug the field names, I see that my app is tweaking the
field names, apparently because they are dupes (?).

?ds.Tables(0) .TableName
"Category"
?ds.Tables(0) .Columns(0).Col umnName
"CategoryId "
?ds.Tables(0) .Columns(1).Col umnName
"Category_I d"

Am I not allowed to duplicate field and/or table names?

Looks like because my table is named "Category", that I can't also have
field named "Category".

If so, then I can't have an easy translation from SQL Server (PK/FK
similar field names) to XML. I guess I have to tweak my field names
before writing to XML? How should I go about doing this, or am I getting
something wrong.

I'd say that what you got "wrong" is that you misuse the concept of a
name. I always say to name a thing for what it is, which implies that
things with the same name should be the same thing. Clearly, your
"Category" field is not the same as your "Category" table. Perhaps your
"Category" field would better be named "CategoryNa me". It will presumably
be a unique field.
--
John Saunders [MVP]



May 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3147
by: Seth | last post by:
I have a query with field names and . When I access any given record in form "test", I want the user to be alerted if there is more than one record with the same first name and last name. This is different from most posts I've read in that this doesn't happen upon data entry since my data is imported and already verified. Duplicate first...
1
2749
by: rech340 | last post by:
I have a table with the following: AutoNumber Course Name (a text field) I want to add a Section Field that increments beginning with 001 all the way to 999, for Each UNIQUE Course Name. For Example: Let's say I have a course Name in this table of "MS Word 2003 Level 1".
24
14395
by: cassetti | last post by:
Here's the issue: I have roughly 20 MS excel spreadsheets, each row contains a record. These records were hand entered by people in call centers. The problem is, there can and are duplicate phone numbers, and emails and addresses even person names. I need to sift through all this data (roughly 300,000+ records and use fuzzy logic to break...
8
3920
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on this line: Set rs = db.OpenRecordset("SELECT ID FROM Contacts WHERE (" & sWhere & ");") Contacts being the main table. I am using access 2003...
1
8940
by: v.maggs | last post by:
Folks, I have two tables, and , both containing a field with the same name, . This field defines the primary/foreign key relationship between the two tables. It's the primary key for . I am trying to insert a record in the table but Access is fussing because the field names are the same. How does one alias a field in the query?
6
1625
by: powelly | last post by:
Sorry for the title did not know what to call this. I have 1 "All" table with the following field names ID --> Autonumber and Primary Key Firstname --> Text Surname --> Text Doctor --> Text Diagnosis --> Text Notes --> Text
3
1272
by: peterkennett | last post by:
I have three tables, all linked. Table 1 "job" has an autonumber ID field. Table 2 "tasks" has a field that is linked to Table 3 "staff" has a field that also links to The purpose is to track multiple tasks and multiple staff who are working on a single job. There can be a random number of tasks per JOB, and a random number of staff per...
5
1843
by: Brett Barry: Go Get Geek! | last post by:
Hello, Can someone please paste VBA code and how I would go about doing this?: I have a customer table with over 6000 duplicates in the field called "Customer". While the customer names may be duplicates the data in other fields is different. I would like to import all of the customers including the duplicates; however, the program I am...
4
2174
by: N2Deep | last post by:
I have a table named SUPPORT DATA, I have a field named Serial Number. In the Serial Number field I have many duplicates, and I only want one of each. Sample serials ABB045000MG, JBX05050016 Until now I have been running an update query which identifies the duplicate serial numbers in the SUPPORT DATA table by: In (SELECT FROM As Tmp...
0
7808
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.