XML Data: Sample and Explanation
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE NFLDSTAT SYSTEM "NFLDSTAT.dtd">
<NFLDSTAT>
<DATE>2003-08-20</DATE>
<SOURCE office="NY" />
<PRECORD gender="M">
<P_CODE>JOHNSONR</P_CODE>
<P_PUNTYDS>53</P_PUNTYDS>
</PRECORD>
<PRECORD gender="F">
<P_CODE>DIFRANCOA</P_CODE>
<P_PUNTYDS>41</P_PUNTYDS>
</PRECORD>
</NFLDSTAT>
- XML Declaration: specifies the version of XML being used
- Document Type Declaration:
states the Root Element and DTD (Document Type Definition)
- Elements are the building blocks of XML:
start with "<" then element name
- Root Element:
the tags that hold the XML document (
<NFLDSTAT>)
- Elements:
(aka paired elements) have start and end tags, data can be in the
start-tag's attributes and/or between the tags themselves (
<DATE>)
- Empty Elements:
single tag, closed by "/>", data in
the attributes (
<SOURCE.../>)
- Character Data: information between elements (
JOHNSONR)
- Attributes: name/value pairs in start-tags (
gender="F")