Understanding XML DTDs

 < Day Day Up > 

Because DTD conformance is important for Tiles tags, a brief overview of how XML DTDs work is given here. DTDs specify a set of tags and attributes that make up a specific XML document type. DTDs also specify the order in which tags must be placed in the file, and the relationship between tags. For example, a tag definition defines what other tags can be nested inside of it, how many occurrences can be nested, and in what order the nesting can occur. Additionally, DTDs define which tag attributes are required and which are optional.

Each tag described in this chapter has a DTD Definition section that lists the tag’s definition in the Tiles configuration file DTD. The definitions will be similar to the one shown in the following snippet:

<!ELEMENT definition (icon?,display-name?,description?,put*,putList*)>

This example defines a “definition” tag and the tags that can be nested inside of it. According to the definition, the tag can have nested icon, display-name, description, put, and putList tags. The question mark (?) and asterisk (*) characters following the nested tags’ names indicate the number of times the nested tag can be nested. The ? character indicates that the tag can be nested zero or one time. The * character indicates that the tag can be nested zero or more (unlimited) times. A plus (+) character indicates that the tag must be nested at least once and as many times as you’d like. No trailing character means that the tag must be nested exactly once and no more. If no tags can be nested inside the defined tag, EMPTY is used to denote that, as shown next:

<!ELEMENT set-property EMPTY>

 < Day Day Up > 

Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2003
Pages: 134
Authors: James Holmes

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net