deprecated/buildtools/buildsystemtools/lib/XML/DOM/Attr.pod
changeset 662 60be34e1b006
parent 655 3f65fd25dfd4
equal deleted inserted replaced
654:7c11c3d8d025 662:60be34e1b006
       
     1 =head1 NAME
       
     2 
       
     3 XML::DOM::Attr - An XML attribute in XML::DOM
       
     4 
       
     5 =head1 DESCRIPTION
       
     6 
       
     7 XML::DOM::Attr extends L<XML::DOM::Node>.
       
     8 
       
     9 The Attr nodes built by the XML::DOM::Parser always have one child node
       
    10 which is a Text node containing the expanded string value (i.e. EntityReferences
       
    11 are always expanded.) EntityReferences may be added when modifying or creating
       
    12 a new Document.
       
    13 
       
    14 The Attr interface represents an attribute in an Element object.
       
    15 Typically the allowable values for the attribute are defined in a
       
    16 document type definition.
       
    17 
       
    18 Attr objects inherit the Node interface, but since they are not
       
    19 actually child nodes of the element they describe, the DOM does not
       
    20 consider them part of the document tree. Thus, the Node attributes
       
    21 parentNode, previousSibling, and nextSibling have a undef value for Attr
       
    22 objects. The DOM takes the view that attributes are properties of
       
    23 elements rather than having a separate identity from the elements they
       
    24 are associated with; this should make it more efficient to implement
       
    25 such features as default attributes associated with all elements of a
       
    26 given type. Furthermore, Attr nodes may not be immediate children of a
       
    27 DocumentFragment. However, they can be associated with Element nodes
       
    28 contained within a DocumentFragment. In short, users and implementors
       
    29 of the DOM need to be aware that Attr nodes have some things in common
       
    30 with other objects inheriting the Node interface, but they also are
       
    31 quite distinct.
       
    32 
       
    33 The attribute's effective value is determined as follows: if this
       
    34 attribute has been explicitly assigned any value, that value is the
       
    35 attribute's effective value; otherwise, if there is a declaration for
       
    36 this attribute, and that declaration includes a default value, then
       
    37 that default value is the attribute's effective value; otherwise, the
       
    38 attribute does not exist on this element in the structure model until
       
    39 it has been explicitly added. Note that the nodeValue attribute on the
       
    40 Attr instance can also be used to retrieve the string version of the
       
    41 attribute's value(s).
       
    42 
       
    43 In XML, where the value of an attribute can contain entity references,
       
    44 the child nodes of the Attr node provide a representation in which
       
    45 entity references are not expanded. These child nodes may be either
       
    46 Text or EntityReference nodes. Because the attribute type may be
       
    47 unknown, there are no tokenized attribute values.
       
    48 
       
    49 =head2 METHODS
       
    50 
       
    51 =over 4
       
    52 
       
    53 =item getValue
       
    54 
       
    55 On retrieval, the value of the attribute is returned as a string. 
       
    56 Character and general entity references are replaced with their values.
       
    57 
       
    58 =item setValue (str)
       
    59 
       
    60 DOM Spec: On setting, this creates a Text node with the unparsed contents of the 
       
    61 string.
       
    62 
       
    63 =item getName
       
    64 
       
    65 Returns the name of this attribute.
       
    66 
       
    67 =back