• Table 3.8 Attribute List Declarations Part 3: Assigning an Attribute’s Default Values Attribute Type Declaration Interpretation
  • Supplied Attribute Values




    Download 2,96 Mb.
    Pdf ko'rish
    bet84/131
    Sana14.05.2024
    Hajmi2,96 Mb.
    #232039
    1   ...   80   81   82   83   84   85   86   87   ...   131
    Bog'liq
    Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

    Supplied Attribute Values
    The term 
    supplied value
    is not an official one. It’s one we cooked up, but perhaps you will 
    agree with our nomenclature after you’ve heard our reasoning.
    With supplied value attribute defaults, the DTD supplies a default value if one is not 
    provided in the XML document. Where it differs from any of the other values is that if the 
    document contains a valid value, it gets passed on; if the attribute value (or even the 
    attribute itself) is missing, supplied values get passed on to the application using the 
    parser.
    Here’s what the supplied value attribute default looks like:
    Another example:


    - 88 -
    Table 3.8 summarizes the usage of attribute defaults.
    Table 3.8 Attribute List Declarations Part 3: Assigning an Attribute’s Default 
    Values
     
    Attribute Type Declaration
    Interpretation
     
    CDATA #REQUIRED>
    #REQUIRED default. The XML Document 
    must supply the value of the attribute 
    manufacturer;
    otherwise the parser issues an 
    error.
    Acceptable XML document entry:

    Unacceptable entry:

    CDATA 
    #IMPLIED>
    #IMPLIED default. The XML document doesn’t 
    have to supply a value (the parser disregards 
    value). The XML application decides what to 
    do next. 
    Acceptable XML document entries:

    or

    CDATA 
    #FIXED
    "Korean">
    #FIXED default. The 
    car
    attribute can have 
    only one value: Korean. The XML Document 
    must supply either no value or the exact same 
    value.
    Acceptable XML document entries:

    or

    CDATA "Korean">
    Supplied default. If a value is supplied, the 
    parser passes it on. If no value is supplied, the 


    - 89 -
    parser passes on the default value 
    Korean
    .
    Acceptable XML document entries:

    or

    or


    Download 2,96 Mb.
    1   ...   80   81   82   83   84   85   86   87   ...   131




    Download 2,96 Mb.
    Pdf ko'rish