Quantcast
Channel: XML attribute vs XML element - Stack Overflow
Browsing all 22 articles
Browse latest View live

Answer by Display name for XML attribute vs XML element

The clear and unambiguous definition of an XML element is everything from (including) the element's start tag to (including) the element's end tag.The below example is an element with text and a child...

View Article



Answer by MGrier for XML attribute vs XML element

I am always surprised by the results of these kinds of discussions. To me there is a very simple rule for deciding whether data belongs in an attribute or as content and that is whether the data has...

View Article

Answer by kjhughes for XML attribute vs XML element

XML Element vs XML AttributeXML is all about agreement. First defer to any existing XML schemas or established conventions within your community or industry.If you are truly in a situation to define...

View Article

Answer by Walter A. Jablonowski for XML attribute vs XML element

This is very clear in HTML where the differences of attributes and markup can be clearly seen:All data is between markupAttributes are used to characterize this data (e.g. formats)If you just have pure...

View Article

Answer by oh pot for XML attribute vs XML element

Attributes can easily become difficult to manage over time trust me. i always stay away from them personally. Elements are far more explicit and readable/usable by both parsers and users.Only time i've...

View Article


Answer by rpattabi for XML attribute vs XML element

How about taking advantage of our hard earned object orientation intuition? I usually find it is straight forward to think which is an object and which is an attribute of the object or which object it...

View Article

Answer by Archimedes Trajano for XML attribute vs XML element

I use the following guidelines in my schema design with regards to attributes vs. elements:Use elements for long running text (usually those of string ornormalizedString types) Do not use an attribute...

View Article

Answer by dan04 for XML attribute vs XML element

"XML" stands for "eXtensible Markup Language". A markup language implies that the data is text, marked up with metadata about structure or formatting.XHTML is an example of XML used the way it was...

View Article


Answer by Patrick for XML attribute vs XML element

Others have covered how to differentiate between attributes from elements but from a more general perspective putting everything in attributes because it makes the resulting XML smaller is wrong. XML...

View Article


Answer by brianary for XML attribute vs XML element

Just a couple of corrections to some bad info:@John Ballinger: Attributies can contain any character data. < >& "' need to be escaped to &lt; &gt; &amp; &quot; and &apos;...

View Article

Answer by peter.murray.rust for XML attribute vs XML element

There is no universal answer to this question (I was heavily involved in the creation of the W3C spec). XML can be used for many purposes - text-like documents, data and declarative code are three of...

View Article

Answer by ottodidakt for XML attribute vs XML element

I agree with feenster. Stay away from attributes if you can. Elements are evolution friendly and more interoperable between web service toolkits. You'd never find these toolkits serializing your...

View Article

Answer by Michael J for XML attribute vs XML element

Use elements for data and attributes for meta data (data about the element's data).If an element is showing up as a predicate in your select strings, you have a good sign that it should be an...

View Article


Answer by user44350 for XML attribute vs XML element

Some of the problems with attributes are:attributes cannot contain multiple values (child elements can)attributes are not easily expandable (for future changes)attributes cannot describe structures...

View Article

Answer by AnthonyWJones for XML attribute vs XML element

It may depend on your usage. XML that is used to represent stuctured data generated from a database may work well with ultimately field values being placed as attributes.However XML used as a message...

View Article


Answer by Rory Becker for XML attribute vs XML element

It's largely a matter of preference. I use Elements for grouping and attributes for data where possible as I see this as more compact than the alternative.For example I prefer.....<?xml...

View Article

Answer by user1921 for XML attribute vs XML element

I use this rule of thumb:An Attribute is something that is self-contained, i.e., a color, an ID, a name.An Element is something that does or could have attributes of its own or contain other...

View Article


Answer by Luke for XML attribute vs XML element

When in doubt, KISS -- why mix attributes and elements when you don't have a clear reason to use attributes. If you later decide to define an XSD, that will end up being cleaner as well. Then if you...

View Article

Answer by erickson for XML attribute vs XML element

It is arguable either way, but your colleagues are right in the sense that the XML should be used for "markup" or meta-data around the actual data. For your part, you are right in that it's sometimes...

View Article

Answer by Adam for XML attribute vs XML element

the million dollar question!first off, don't worry too much about performance now. you will be amazed at how quickly an optimized xml parser will rip through your xml. more importantly, what is your...

View Article
Browsing all 22 articles
Browse latest View live




Latest Images