469,644 Members | 1,696 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

XML Attributes vs Elements

Howdy,

I just had a small explosion in my brain, and now i'm a little more confused
than I was before. I'm fairly new to XML, but understand it for the most
part in regards to formatting. I have some XML files I use for populating
dropdowns, like a statelist and other options. These are setup in the XML
file with attributes.

<root>
<state name=Massachusetts abb=MA/>
</root>

I also have XML files which I read and write to, using Elements and an XSD
for the dataset.

<root>
<article>
<title>Here</title>
<date>5/14/07</date>
<body>Hi there</body>
</article>
</root>

I know elements are treated as a separate entity, if i may use that word,
from the parent node. And I understand that data controls like a
dropdownlist looks for the properties/attributes as specified in its
properties so the attributes of XML is preferred and easy to use. What
doesn't make sense is that a Dataset will read from either and write back in
that same format it read from, now the issue is when a XML file is empty,
and a dataset writes to it, it defaults to elements instead of attributes,
which then causes a few issues until I create the XSL file, which then my
issues are gone. And from there it's OK and will work forever.

So, I guess I'm stating this more out of frustration with hopes of a little
clarity if I missed something. It's a lessoned learned, if I deal with XML
data in attributes i'm fine, and if I start with elements I should expect to
build a XSD and an XSL file.

David

May 14 '07 #1
0 1102

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John L. Clark | last post: by
2 posts views Thread by Stewart Johnson | last post: by
9 posts views Thread by Soren Kuula | last post: by
7 posts views Thread by Info 3000 | last post: by
1 post views Thread by Tod Johnson | last post: by
6 posts views Thread by Jakub.Bednarczuk | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.