The age old debate of Attributes vs. Elements

Hi all, I have to decide on an XML structure going forward.  The
structure is going to house a large amount of data.  In the past I've
always just used the philosophy of "when in doubt use elements" - but
I just read this article:
http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnexxml/html/xml02212000.asp

And there is some indication that you will gain performance benefits
from XML that uses attributes rather than elements - example:

<grandparent>
  <parent>
    <child>
      <name>
        tony
      </name>
    </child>
    <name>
      Sarah
    </name>
  </parent>
  <name>
    Tom
  </name>
</grandparent>
OR
<grandparent name='Tom'>
  <parent name='sarah'>
    <child name='tony'>
    </child>
  </parent>
</grandparent>

Now obviously in the first case you leave it open if you want to have
a deeper structure to name - like firstName, lastName, middleName,
alias, etc.

But if we were to assume that the XML structure will never change (I
know that is unlikely in many scenarios) but if it were to remain the
same, would there likely be a decrease in parsing time when I use the
transform method of XSLTransform (the .NET class) - in addition, I am
passing XPath queries (through a XPathNodeIterator object).

Thanks,
Novice
0
6tc1 (3)
4/21/2004 8:46:15 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
319 Views

Similar Articles

[PageSpeed] 37

Novice wrote:

> <grandparent name='Tom'>
>   <parent name='sarah'>
>     <child name='tony'>
>     </child>
>   </parent>
> </grandparent>
> 
> Now obviously in the first case you leave it open if you want to have
> a deeper structure to name - like firstName, lastName, middleName,
> alias, etc.

The same in the second one - what's wrong with firstName attribute?

> But if we were to assume that the XML structure will never change (I
> know that is unlikely in many scenarios) but if it were to remain the
> same, would there likely be a decrease in parsing time when I use the
> transform method of XSLTransform (the .NET class) - in addition, I am
> passing XPath queries (through a XPathNodeIterator object).

Well, querying attributes is probably faster than child nodes, but large 
  attribute collection isn't good idea either.
I don't think there is any substantial difference. Do it as you feel 
better for you.

-- 
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
0
Oleg
4/22/2004 10:04:05 AM
I think the choice between using attributes vs. elements should be based on
the semantics of the data rather than the performance aspect.

I remember reading an article that provided a guideline for using attributes
vs. elements and it was something like use attributes for metadata for the
element node and elements for the actual content.
I am probably bastardizing the originally elegantly put statement here but
you get the gist.  The author also mentioned and I agree that the line
between what is metadata and data isn't all that clear always.  So you
should use your judgement.

For your example, I guess something like a person's names or SSN may be a
good fit for attributes whereas, what kind of car they drive and where they
live clearly works better as elements.
Just my 2 cents!

Jiho Han

"Novice" <6tc1@qlink.queensu.ca> wrote in message
news:b80e4a77.0404211246.8a8624a@posting.google.com...
> Hi all, I have to decide on an XML structure going forward.  The
> structure is going to house a large amount of data.  In the past I've
> always just used the philosophy of "when in doubt use elements" - but
> I just read this article:
>
http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnexxml/html/xml02212000.asp
>
> And there is some indication that you will gain performance benefits
> from XML that uses attributes rather than elements - example:
>
> <grandparent>
>   <parent>
>     <child>
>       <name>
>         tony
>       </name>
>     </child>
>     <name>
>       Sarah
>     </name>
>   </parent>
>   <name>
>     Tom
>   </name>
> </grandparent>
> OR
> <grandparent name='Tom'>
>   <parent name='sarah'>
>     <child name='tony'>
>     </child>
>   </parent>
> </grandparent>
>
> Now obviously in the first case you leave it open if you want to have
> a deeper structure to name - like firstName, lastName, middleName,
> alias, etc.
>
> But if we were to assume that the XML structure will never change (I
> know that is unlikely in many scenarios) but if it were to remain the
> same, would there likely be a decrease in parsing time when I use the
> transform method of XSLTransform (the .NET class) - in addition, I am
> passing XPath queries (through a XPathNodeIterator object).
>
> Thanks,
> Novice


0
jiho.han (47)
4/22/2004 3:23:22 PM
Reply:

Similar Artilces:

I want to use my old backup (floppy) of Money 2001..
I would like to use my backup floppy of M2001 on my new PC with XP, so I can start using it, and it won't work or convert this file. What do I need to do? I do not want to have top re-enter all the info from the last several years-am I out-of luck?.... We need some more information to give you a good answer. What version of Money is on your new PC? What, exactly, are you trying to do to restore the data from the floppy? The floppy has a .MBF backup file from M01? There's just one floppy? What messages, exactly, are you getting?!? "Jerry D" <anonymous@discussions.m...

Multiple VS instances
For unknown reasons, VS6 does not open multiple instances any more when I double-click on several dsw files. That is, on double-click, the same running instance of VS6 is reused. Can't figure out why. It was fine until yesterday and has been fine for a long time... but now I cannot get it to work. Any pointers will be much much appreciated. On Feb 22, 12:24=A0pm, Alexander <the44s...@yahoo.com> wrote: > For unknown reasons, VS6 does not open multiple instances any more > when I double-click on several dsw files. That is, on double-click, > the same running instance of VS6 i...

File Attributes Column
How can I display a "file attributes" column in Outlook 2000 when viewing files and directories? ...

New user attributes problem
When I create new mailbox for existing AD user all Exchange attributes appears correctly, but user's address list attribute is empty. I can add SMTP address manually, and mailbox can send and recieve mail, but user does not appear in global address lists. It worked fine before yesterday. I suppose some right to AD objects was corrupted. Can anyone tell me what rights I need to restore? Any error in event log? Try right-clicking on your "Recipients Update Service" and click "Rebuild". Wait for about 15 minutes, then right-click again and click "Update" wait ...

Age Formula
Hi all, I need to compute ages (as of 6-1-04) from dates of birth on a speadsheet I'm working on. I have NO idea where to start on that. Help please? Thanks in advance! Trish try this =DATEDIF(C6,"6/10/04","Y") -- Don Guillett SalesAid Software donaldb@281.com "Trish" <anonymous@discussions.microsoft.com> wrote in message news:1a55a01c44e51$e25e60d0$a501280a@phx.gbl... > Hi all, > > I need to compute ages (as of 6-1-04) from dates of birth > on a speadsheet I'm working on. I have NO idea where to > start on that. Help please? &...

aging report
I have a cell with a number in it and i want to put that number in another column based on number in that column. days 1-10 days 11-20 days 21-30 days > 30 days a1: 10 I want the number to show up in the corresponding column and put a zero in the other columns. I have a formula for the 1-10 days and the >30 days, but i need some help with a formula for the 11-20 and 21-30 days. thanks For the 11-20 days column, you could use a formula like: =IF(AND($A2>=11,$A2<=20),$A2,0) Then, copy the formula to the 21-30 days column, and adjust the 1...

Getting attribute value in vb code not working...please help
Hi, sorry I've asked similar questions, but still having trouble. I'm using asp.net (vb.net). I select a node from an xmlDoc string (I've made sure that the intended item exists), then want to determine if that node exists, then get a certain attribute value and assign that to a variable. Simple. But when I run it (including debug with breaks) no value gets assigned...it just skips from my If... line to the code after the End If. Similar code works if I'm looking at previous-sibling, but no following-sibling so I was hoping someone could at least tell me that my xpath looks ok...

Abstract Id attribute value
Dear Friends, Actually i want to retrieve "id" attribute's value from the source page [Right click on a Webpage->Select 'View Source'].For example - 'id' of PasswordBox . Right now i able to retieve the values of attributes like- 'type','name','image'. But i unable to retieve value of 'id'. I'm using VC++ .Please any one help me out in this regard soon Thankx "pk jena" <pkj.help@gmail.com> wrote in message news:a6db89ca-1ad5-45f2-a180-b377e949b63e@42g2000prb.googlegroups.com... > De...

ESM will not purge orphan account from old server
Hopefully someone can answer this question. We are moving from Exchange 2000 sp3 running on Server 2000 sp4 to Server 2003 and Exchange 2003. All users are moved to the new box and things are functioning. When un-installing Exchange 2000 to pull it out totally, I still see 1 user account left and it will not un-install. In ESM the account shows with a RED x. I can reconnect it to a test user account. Through AD I can take the Exchange mailbox away, run cleanup and I get the RED x back. When I attempt to purge, I click ok and the screen refreshes and the account does not disappear...

Restricting Old accounts
I have old GL accounts that we are not using anymore, what is the best way to ensure that they are not being used on our balance sheets generated within GP and in FRx? Hi Michael, If there are no balances and transactions for the open fiscal year, you can inactivate the account. Inactivated accounts are by default not included in GP reporrs and FRx will do the same. Lastly, accounts that are inactive will not be accidentally used in transaction entry. Hope this helps! Cheers, Dennis Araullo, MACS Microsoft Certified Technology Specialist GP,CRM,AX MCITP Installatio...

Graph
Hi, Here is the problem - There is a graph I have to create, based on the following information: I have projects names, and each project has the following data: 1. Estimated cost. 2. Actual cost. 3.Status, which can be one of 3: a. over with b. in progress c. per demand I need to put the data on a 3D column graph, in a way that each project will have 2 columns that compare estimated and actual cost, but the problem is I also need to put some kind of an attribute on every project which reflects its status. How do I do that? Thanks in advance, Chen. Chen - I'd suggest a 2D chart type in...

New Exchange Server, Old POP3 Woes
Hello, all; I have a client who just converted from a POP3 hosting service to their own Exchange server. The problem is that when they go to reply to messages received before the transfer happened, Outlook tries sending it through the old POP3 server (which is no longer valid), and the message sits in the Outbox. The user can force the email to go through MS Exchange, but that is a clunky fix. Any ideas? Ben b2 consulting <jbbarr@gmail.com> wrote: > Hello, all; > > I have a client who just converted from a POP3 hosting service to > their own Exchange server. The probl...

Automatic vs SemiAutomatic
What is the difference between setting the application calculation mode to 'Automatic' or 'SemiAutomatic' Its the same unless you are using Tables for repetitive calculations, in which case semiautomatic means automatic except for tables. regards Charles ______________________ Decision Models FastExcel Version 2 now available. www.DecisionModels.com/FxlV2WhatsNew.htm "Bill" <nunnallywilliamr@uams.edu> wrote in message news:CBC5A136-651D-4ED8-A6B3-31D7FBB91A60@microsoft.com... > What is the difference between setting the application calculation mode to &#...

Calculate Age...?
I have a sheet with the formula.. =DATEDIF(A20,NOW(),"Y")&":Yrs "&DATEDIF(A20,NOW(),"YM")&":Months "&DATEDIF(A20,NOW(),"MD")&":Days" where A20 contains a birthday...! Can any of you clever guys tell me why It doesn't seem to be working correctly. Its supposed to return the age "X:Yrs Y:Months Z:Days". Thanx for any assist. Andrew Andrew, The formula works fine for me. Exactly what problems are you having? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, L...

Age
I see many example of age from date of birth Howevere when the year of the date of birth is over 1929 ie age 88 the age turn out to be negative say dob is 01 jan 1928 or less Can any ne help? klam Klam, have a look at this about age functions and why some work and others do not. http://www.allenbrowne.com/func-08.html Jeanette Cunningham "Klam" <Klam@discussions.microsoft.com> wrote in message news:3902CAC7-F84A-417C-9AFA-43AFBB58AC6E@microsoft.com... >I see many example of age from date of birth > Howevere when the year of the date of birth is over 1929 ie age 88 t...

Calculate age as of a given date
For group insurance enrollment, given the date of birth, we need to compute each employee's age as of a certain date, such as 1/1/2005. What formula would accomplish this? -- Joe S. Hi see your other post -- Regards Frank Kabel Frankfurt, Germany "Joe S." <JoeS@discussions.microsoft.com> schrieb im Newsbeitrag news:0F629BA6-4773-49AD-B66B-52F97F5CBB3A@microsoft.com... > For group insurance enrollment, given the date of birth, we need to compute > each employee's age as of a certain date, such as 1/1/2005. What formula > would accomplish this? > -- >...

aging payables and historical aging payables report
Hi, I am wondering what is the difference between these two reports. sometimes i get the same total amounts and others i find the total different on each report. I tought that the historical aging report will show only transactions with "history" status,but unfortunately this not the case. le me rephrase my qestion...if i want to reconcile my gl with AP or AR which report i should use ? many thanks Bryan, The main difference between these 2 reports is that the historical one checks both open and historical tables for data, while the other one only checks the open tables. If ...

Clean up old print drivers
Mary, You posted the following as a link to clean up old printer drivers, and the link doesn't seem to work. Do you have a more current one? Thanks. How to clean up printer drivers http://members.shaw.ca/bsanders/CleanPrinterDrivers.htm DavidF Never mind...it works now. du'oh davidf "DavidF" <Nope@nospam.com> wrote in message news:utGjFXMjFHA.3436@tk2msftngp13.phx.gbl... > Mary, > > You posted the following as a link to clean up old printer drivers, and the > link doesn't seem to work. Do you have a more current one? Thanks. > > How to clea...

age in days
hi, i was wondering if anyone knows how to work out my age in days my birthday is the 05/08/88 and todays date is 03/03/04 thanks! --- Message posted from http://www.ExcelForum.com/ Hi have a look at http://www.contextures.com/xlfaqApp.html#Unused and use the DATEDIF function with the "d" parameter -- Regards Frank Kabel Frankfurt, Germany "marie >" <<marie.12k4be@excelforum-nospam.com> schrieb im Newsbeitrag news:marie.12k4be@excelforum-nospam.com... > hi, i was wondering if anyone knows how to work out my age in days > my birthday is the 05/08/88 &...

Access 2007 Ole Objects vs Pictures
I had 2003(?) on my laptop and was able to attach bitmap pictures to records in the tables. Out of curiosity I did the mistake to open Picture Manager(?) to see what it would offer. It set itself as default program for pictures and I was doomed. If I try to insert a new picture into a record in my table, it shows as "Package". And it won't allow to convert to bitmap. The only way I can get the pictures into the record is to add a new one, open it, paste the picture into it and safe it/update the table. There has to be an easier way to do this. This data base is extremely i...

How Calculate "Days Old" on Work order summary report
I am trying to modify the Work order summary report to calculate a column using the workorder date and the current date to show how old a work orderis in Days "Days Old" Can some one tell me how to create this column in a report? thanks DDOWNINGMO -- RMS 1.3, MSDE 3 Lanes, 5 Back Office Clients XP sp2 Server 2003 sp1 Domain Static IP Just wondering if anybody had any ideas on this post from 60 days ago. It seems like it should be easy to calculate days from the date fields. I just did not want to "re-invent the wheel" if someone has already done this column. Tha...

Recordsets-Old and New
I am trying to create two recordsets from a single form, one when the form is first opened and a second after updates (not entry) are entered. The first recordset, rsOpen, is defined on the form_open event: sNewVal = "Select * from tblClasses where Itemid = " & Me.ItemID Set rsOpen = CurrentDb.OpenRecordset(sNewVal) ''' get orginal values The second I would like to define when a Submit button is clicked: Me.Dirty = False sNewVal = "Select * from tblClasses where Itemid = " & Me.ItemID Set rsSubmit = CurrentDb.OpenRec...

RTV
What is the difference between the Closed and Ready to Close Status. All of our RTV's show as Ready to Close, what will happen if we change the status to closed? Is there any financial impact if we do this? Should we do this? Ready to Close indicates that all of the conditions necessary to close the RTV document have been completed. However, new transactions can still be posted to the document. Closed stops the entry/posting of all transactions to the RTV -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks News...

old newsgroups
What folder in Vista home premium contains the newsgroups you visit? Windows 95 and 98 had a windows system folder that kept the names of the newsgroups until you deleted them...Thanks "Bill Walsh" <wwalsh7740@optimum.net> wrote in message news:%231v2QulhKHA.1456@TK2MSFTNGP06.phx.gbl... > What folder in Vista home premium contains the newsgroups you visit? > Windows 95 and 98 had a windows system folder that kept the names of the > newsgroups until you deleted them...Thanks What are you wanting to do? The folder that WM uses is at C:\Users\*your us...

works cited vs. Bibliography
I was really thrilled to learn about the citations & Bibliography features available in Word 2007, however what puzzels me a bit is that it appears to be possible to create both 'bibliographies' and 'works cited' lists. This, I thought, would imply that one is the total list of sources used - the other just the ones quoted. It seems they are exactly the same! Am I overlooking something, is this a bug, or ? Your thinking is correct, but this is not a bug. You are being mislead as those words are just titles of building blocks. They don't represent a diffe...