Tags:XML Questions | 26 views
like to store data in child elements.
The following three XML documents contain exactly the same information:A date attribute is used in the first example:
< note date=”12/11/99″ >
< to > Tove < /to > < from > Jani < / from >
< heading > Reminder < /heading >
< body > Don’t forget me this weekend! < [...]
Tags:XML Questions | 25 views
you avoid using attributes?
Here are some of the problems using attributes:
attributes cannot contain multiple values (child elements can)
attributes are not easily expandable (for future changes)
attributes cannot describe structures (child elements can)
attributes are more difficult to manipulate by program code
attribute values are not easy to test against a DTD
If you use attributes as containers for data, [...]
Tags:XML Questions | 35 views
Rules always have exceptions.
My rule about attributes has one exception:
Sometimes I assign ID references to elements. These ID references can be used to access XML elements in much the same way as the NAME or ID attributes in HTML.
This example demonstrates this:
< messages >
< note id=”p501″ > < to > Tove < /to > < [...]
Tags:XML Questions | 29 views
“Well Formed” XML document has correct XML syntax.
A “Well Formed” XML document is a document that conforms to the XML< ?xml version=”1.0″ encoding=”ISO-8859-1″? >
< note >
< to > Tove < /to >
< from > Jani < /from >
< heading > Reminder < /heading >
< body > Don’t forget me this weekend! < /body >
< /note [...]