“Valid” XML
adheres to basic structural requirements
also adheres to content-specific specifications
– document type descriptor (DTD)
– XML schema (XSD)
test XML with validating XML parser
DTDs
grammar-like language for specifying elements, attributes, nesting, ordering, #occurrences
also special attribute types ID and IDREFs
Benefits of using DTDs
programs can assume structure
CSS/XSL can assume structure
specification – data exchange
documentation
Benefits of NOT using DTDs
flexibility, ease of change
DTDS can be messy – irregular
XSDs can be REALLY messy
ID and IDREF attributes
give elements IDs and refer to them in other elements with IDREFs
must be unique
#REQUIRED vs #IMPLIED
use symbols like regular expressions
| | or |
* | 0 or more |
? | optional |
CDATA or #PCDATA | strings |
+ | 1 or more |