• Scenario: Specifying an Element That Can Contain “Any” Elements and Character Data
  • Scenario: Specifying a Single Element That Contains Character Data
  • Scenario: Specifying an Element with No Content




    Download 2,96 Mb.
    Pdf ko'rish
    bet72/131
    Sana14.05.2024
    Hajmi2,96 Mb.
    #232039
    1   ...   68   69   70   71   72   73   74   75   ...   131
    Bog'liq
    Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

    Scenario: Specifying an Element with No Content
    When an element has no content (that is, an empty element) the content model is 
    described by the word EMPTY. The Element Type Declaration for an element called 
    vessel
    whose contents are empty is:

    When creating the actual XML document itself, the 
    vessel
    element would appear as 
    this:

    or

    If any content is found in the 
    vessel
    element, the parser indicates an error.


    - 71 -
    Scenario: Specifying an Element That Can Contain “Any” Elements 
    and Character Data
    The ANY content model descriptor is the most loosely defined way of describing an 
    element. ANY implies that the element can be an undefined mixture of elements that 
    have been declared in the DTD as well as character data.
    The Element Type Declaration for an element called catch_all is:
    A word of caution when using the ANY descriptor: Elements that inherit their complete 
    characteristics can not be overridden by an undefined element. If you include a flavors 
    element that has been previously defined to contain a choice of vanilla, chocolate, or 
    strawberry, you can not override the flavors definition by putting in an unspecified flavor 
    element, for example cookie_crumble.
    Scenario: Specifying a Single Element That Contains Character Data
    This is probably one of the most common declarations you will be using. This type of 
    element simply has a name and can contain PCDATA (that is, text only). Here’s the 
    Element Type Declaration:
    Once declared in your DTD, any 
    name
    element in your XML document would look like 
    this:
    Faraz Hoodbhoy
    Under this type definition, 
    name
    elements cannot contain subelements, for example:

    Faraz
    Hoodbhoy

    is not allowed by the parser.

    Download 2,96 Mb.
    1   ...   68   69   70   71   72   73   74   75   ...   131




    Download 2,96 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Scenario: Specifying an Element with No Content

    Download 2,96 Mb.
    Pdf ko'rish