XML: A Managers Guide (2nd Edition) (Addison-Wesley Information Technology Series)

  • An element consists of open and close tags containing the element name surrounding the element content ” <ElementName>element content</ElementName>.

  • Attributes appear in the open tag and consist of an attribute name and an attribute value ”<ElementName attributeName = "attributeValue">.

  • For elements with element content, a DTD specifies the allowable child elements ”<!ELEMENT ElementName (Child1*, Child2?, Child3+)>.

  • *, ?, and + indicate the number of times an element may occur ”0 or more, 0 or 1, and 1 or more, respectively. The default is exactly 1.

  • For elements with data content, a DTD specifies the type of data it may contain ”<!ELEMENT ElementName (#PCDATA)>.

  • For elements with no content, a DTD specifies an empty content model ”<!ELEMENT ElementName EMPTY>.

  • For elements with attributes, a DTD specifies the list of allowable attributes ”

    <!ATTLIST ElementName attributeName1 CDATA "default"> attributeName2 CDATA #REQUIRED attributeName3 (option1 option2) "option1">

  • Default attribute values appear within quotation marks.

  • DTDs can require documents to assign an attribute value explicitly with the "#REQUIRED" keyword.

  • DTDs can specify an enumerated list of allowable attribute values bounded by parentheses with options separated by vertical bars.

Категории