< < less than > > greater than & & ampersand ' ' apostrophe " " quotation mark <!-- This is a comment --> With XML, the white-space in a document is not truncated. HTML truncates multiple white-space characters to one single white-space: <gangster name='George "Shotgun" Ziegler'> OR <gangster name="George "Shotgun" Ziegler"> Avoid XML Attributes? Some of the problems with using attributes are: * attributes cannot contain multiple values (elements can) * attributes cannot contain tree structures (elements can) * attributes are not easily expandable (for future changes) Sometimes ID references are assigned to elements. <messages>
<note id="501">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<note id="502">
<to>Jani</to>
<from>Tove</from>
<heading>Re: Reminder</heading>
<body>I will not</body>
</note>
</messages>
What I'm trying to say here is that metadata (data about data)
should be stored as attributes, and that data itself should be stored
as elements. Well Formed XML Documents- XML documents must have a root element
- XML elements must have a closing tag
- XML tags are case sensitive
- XML elements must be properly nested
- XML attribute values must be quoted
Valid XML and DTD<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE note SYSTEM "Note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<!DOCTYPE note
[
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
|