-
In XML, I can define a tag as either Attribute or Element, which better?
In XML, I can define a tag as either Attribute or Element, which better?
In Part 1, I define the Title as a Attribute, and in Part 2, I define the Title as a Element, which better?
when I use TreeView and GridView control in ASP.Net 2.0, I find it is very advantageous to use Attribute.
but I'm not sure when I need to use Attribute, and when I need to use Element!
//---------------------------Part 1-----------------------------------------
<Folder xmlns="http://www.hellocw.com/onlinebookmark" Name="Root" Id="a6dce8fe-749c-4e38-ab2f-3d03d9711b3d">
<Bookmark BId="f8dce8hj-846c-4e38-ab2f-6d03d9711b80"
Title="CodeGuru Forums - ASP.NET"
Url="http://www.codeguru.com/"
Description="This is a good site"
InputDate="2005-10-29"
IsPrivate="false">
</Bookmark>
<Bookmark BId="fgdce3ak-846c-4e38-ab2f-8i03d9711b23"
Title="We ll e-mail your press release"
Url="http://www.dpdirectory.com/"
Description="This is a new site"
InputDate="2004-11-23"
IsPrivate="true">
</Bookmark>
<Folder Name="Card" Id="b8dcf8fe-749c-4e38-ab2f-6d03d9711b8j">
<Bookmark BId="ghdce3ak-456c-4e38-ab2f-5h02d9711b67"
Title="Welcome to ePassporte"
Url="https://www.epassporte.com/"
Description="This is a big site"
InputDate="2004-08-12"
IsPrivate="false">
</Bookmark>
<Bookmark BId="fkdfh3a8-456c-6y38-jk2f-5h0gh9711b45"
Title="Keystone DreamCard"
Url="https://www.mydreamcardonline.com"
Description="Please note"
InputDate="2004-09-25"
IsPrivate="false">
</Bookmark>
<Folder Name="Type" Id="hkdcf8fe-749c-4e38-ab2f-6d03d9711bfg">
</Folder>
</Folder>
<Folder Name="CD" Id="f5dcf8fe-749c-4e38-ab2f-6d03d9711bdf">
</Folder>
</Folder>
//---------------------------Part 1-----------------------------------------
//---------------------------Part 2-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<Folder Name="Root" Id="a6dce8fe-749c-4e38-ab2f-3d03d9711b3d">
<Bookmark>
<Title>CodeGuru Forums - ASP.NET</Title>
<Url>http://www.codeguru.com/</Url>
<Description>This is a good site</Description>
<InputDate> 2005-12-5</InputDate>
<IsPrivate>False</IsPrivate>
</Bookmark>
<Bookmark>
<Title>We'll e-mail your press release</Title>
<Url>http://www.dpdirectory.com/</Url>
<Description>This is a good site</Description>
<InputDate> 2004-12-5</InputDate>
<IsPrivate>False</IsPrivate>
</Bookmark>
<Folder Name="Card" Id="b8dcf8fe-749c-4e38-ab2f-6d03d9711b8j">
<Bookmark>
<Title>Welcome to ePassporte</Title>
<Url>https://www.epassporte.com/</Url>
<Description>Very Good</Description>
<InputDate> 2004-08-5</InputDate>
<IsPrivate>True</IsPrivate>
</Bookmark>
<Bookmark>
<Title>Keystone DreamCard</Title>
<Url>https://www.mydreamcardonline.com</Url>
<Description>Please note</Description>
<InputDate> 2004-08-5</InputDate>
<IsPrivate>True</IsPrivate>
</Bookmark>
</Folder>
</Folder>
//---------------------------Part 2-----------------------------------------
-
It is all in your preference!
But you can see improved performance with an appropriate mix. search web for XML Performance or Speed blah..
i typically stuff ID ast attribute and or stuff like @name, @title, etc. then typical larger text fields would be Elements..
Similar Threads
-
By mycwcgr in forum Database
Replies: 0
Last Post: 09-25-2005, 04:40 AM
-
By Tim in forum xml.announcements
Replies: 0
Last Post: 10-11-2001, 04:00 PM
-
By Greg Rothlander in forum XML
Replies: 2
Last Post: 06-26-2001, 12:04 PM
-
By Tim Frost in forum xml.announcements
Replies: 0
Last Post: 04-02-2001, 10:53 AM
-
By Lori Taylor in forum VB Classic
Replies: 20
Last Post: 06-14-2000, 11:06 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks