The way attribute value normalization is performed by the DOM implementation depends on how much the implementation knows about the schema in use. Typically, the value and nodeValue attributes of an Attr node initially returns the normalized value given by the parser. It is also the case after Document.normalizeDocument() is called . But this may not be the case after mutation, independently of whether the mutation is performed by setting the string value directly or by changing the Attr child nodes. In particular, this is true when character entity references are involved, given that they are not represented in the DOM and they impact attribute value normalization.
On the other hand, if the implementation knows about the schema in use when the attribute value is changed, and it is of a different type than CDATA, it may normalize it again at that time. This is especially true of specialized DOM implementations, such as SVG DOM implementations, which store attribute values in an internal form different from a string. Type Description IndexSizeError The index is not in the allowed range (e.g. thrown in a range object).
HierarchyRequestError The node tree hierarchy is not correct. WrongDocumentError The object is in the wrong document. InvalidCharacterError The string contains invalid characters. NoModificationAllowedError The object can not be modified. NotSupportedError The operation is not supported InvalidStateError The object is in an invalid state.
SyntaxError The string did not match the expected pattern. InvalidModificationError The object can not be modified in this way. NamespaceError The operation is not allowed by Namespaces in XML InvalidAccessError The object does not support the operation or argument.
TypeMismatchError The type of the object does not match the expected type. URLMismatchError The given URL does not match another URL. InvalidNodeTypeError The node is incorrect or has an incorrect ancestor for this operation. MethodsadoptNode introduced in DOM Level 3Changes the ownerDocument of a node, its children, as well as the attached attribute nodes if there are any. If the node has a parent it is first removed from its parent child list.
This effectively allows moving a subtree from one document to another. The following list describes the specifics for each type of node.ATTRIBUTE_NODEThe ownerElement attribute is set to null and the specified flag is set totrue on the adopted Attr. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned.
MethodName The payment method identifier for the payment method that the user selected to fulfil the transaction. Details A JSON-serializable object that provides a payment method specific message used by the merchant to process the transaction and determine successful fund transfer. This data is returned by the payment method specific code that satisfies the payment request. ShippingAddress If the requestShipping flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then shippingAddress will be the full and final shipping address chosen by the user. ShippingOption If the requestShipping flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then shippingOption will be the id attribute of the selected shipping option. PayerName If the requestPayerName flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then payerName will be the name provided by the user.
PayerEmail If the requestPayerEmail flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then payerEmail will be the email address chosen by the user. PayerPhone If the requestPayerPhone flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then payerPhone will be the phone number chosen by the user. Default attributes are not copied, though if the document being imported into defines default attributes for this element name, those are assigned. Ability to add these imported nodes to aDocumentType will be considered for addition to a future release of the DOM.
NodeList and NamedNodeMap objects in the DOM are live; that is, changes to the underlying document structure are reflected in all relevant NodeList and NamedNodeMapobjects. Likewise, changes to a Node in the tree are reflected in all references to that Node in NodeList and NamedNodeMapobjects. When this occurs in a sub-algorithm, this results in termination of execution of the sub-algorithm and all ancestor algorithms until one is reached that explicitly describes procedures for catching exceptions.
The term extended attribute is defined by [WEBIDL-2]. SetAttributeNS introduced in DOM Level 2Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out.
Specified of type boolean, readonlyTrue if this attribute was explicitly given a value in the instance document, false otherwise. If the application changed the value of this attribute node then it is set to true. The implementation may handle attributes with default values from other schemas similarly but applications should use Document.normalizeDocument()to guarantee this information is up-to-date.
This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as insertBefore, or replaceChild. Each DOM module defines one or more features, as listed in the conformance section .
Features are case-insensitive and are also defined for a specific set of versions. For example, this specification defines the features"Core" and "XML", and thus for the versions "1.0", "2.0", and"3.0". To avoid possible conflicts, as a convention, names referring to features defined outside the DOM specification should be made unique. In a document with no namespaces, the child list of an EntityReference node is always the same as that of the corresponding Entity.
This is not true in a document where an entity contains unbound namespace prefixes. In such a case, the descendants of the corresponding EntityReference nodes may be bound to different namespace URIs, depending on where the entity references are. Also, because, in the DOM, nodes always remain bound to the same namespace URI, moving such EntityReference nodes can lead to documents that cannot be serialized.
This is also true when the DOM Level 1 method Document.createEntityReference is used to create entity references that correspond to such entities, since the descendantsof the returned EntityReference are unbound. The DOM Level 2 does not support any mechanism to resolve namespace prefixes. For all of these reasons, use of such entities and entity references should be avoided or used with extreme care. A future Level of the DOM may include some additional support for handling these.
ELEMENT_NODE Specified attribute nodes of the source element are imported, and the generated Attr nodes are attached to the generated Element. If the importNode deep parameter was set to true, the descendants of the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree. Interface EntityReferenceEntityReference nodes may be used to represent an entity reference in the tree. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building the Document, instead of providing EntityReferencenodes. If it does provide such nodes, then for an EntityReference node that represents a reference to a known entity an Entity exists, and the subtree of the EntityReference node is a copy of the Entity node subtree.
However, the latter may not be true when an entity contains an unbound namespace prefix. In such a case, because the namespace prefix resolution depends on where the entity reference is, the descendants of the EntityReference node may be bound to different namespace URIs. When an EntityReference node represents a reference to an unknown entity, its content is empty. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. On import, the publicId, systemId, and notationName attributes are copied. If the document being imported into provides a definition for this entity name, its value is assigned.NOTATION_NODENotation nodes can be imported, however in the current release of the DOM the DocumentType is readonly.
The normal typecast operation on an object should support the interfaces expected by legacy code for a given document type. Conflicts are most obvious with theDocument object, since it is shared as owner by the rest of the document. In a homogeneous document, elements rely on the Document for specialized services and construction of specialized nodes. In a heterogeneous document, elements from different modules expect different services and APIs from the same Documentobject, since there can only be one owner and root of the document hierarchy.
In general, the DOM implementation doesn't perform any URI normalization or canonicalization. The URIs given to the DOM are assumed to be valid (e.g., characters such as white spaces are properly escaped), and no lexical checking is performed. Absolute URI references are treated as strings and compared literally. How relative namespace URI references are treated is undefined. To ensure interoperability only absolute namespace URI references (i.e., URI references beginning with a scheme name and a colon) should be used. Applications should use the value null as the namespaceURIparameter for methods if they wish to have no namespace.
In programming languages where empty strings can be differentiated from null, the way empty strings are treated, when given as a namespace URI to a DOM Level 2 method, is implementation dependent. This is true even though the DOM does no lexical checking of URIs. Most of the APIs defined by this specification are interfaces rather than classes. That means that an implementation need only expose methods with the defined names and specified operation, not implement classes that correspond directly to the interfaces. This allows the DOM APIs to be implemented as a thin veneer on top of legacy applications with their own data structures, or on top of newer applications with different class hierarchies.
This also means that ordinary constructors (in the Java or C++ sense) cannot be used to create DOM objects, since the underlying objects to be constructed may have little relationship to the DOM interfaces. The conventional solution to this in object-oriented design is to define factory methods that create instances of objects that implement the various interfaces. Objects implementing some interface "X" are created by a "createX()" method on the Documentinterface; this is because all DOM objects live in the context of a specific Document.
AddressLine This is the most specific part of the address. It can include, for example, a street name, a house number, apartment number, a rural delivery route, descriptive instructions, or a post office box number. Region This is the top level administrative subdivision of the country. For example, this can be a state, a province, an oblast, or a prefecture.
DependentLocality This is the dependent locality or sublocality within a city. For example, used for neighborhoods, boroughs, districts, or UK dependent localities. PostalCode This is the postal code or ZIP code, also known as PIN code in India. SortingCode This is the sorting code as used in, for example, France.
LanguageCode This is the BCP-47 language code for the address. It's used to determine the field separators and the order of fields when formatting the address for display. Organization This is the organization, firm, company, or institution at this address. Recipient This is the name of the recipient or contact person.
This field may, under certain circumstances, contain multiline information. Phone This is the phone number of the recipient or contact person. Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone.
This includes text contained in an the Element since the text is contained in a child Text node. Cloning an Attr directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute . Cloning an Attr always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an EntityReferenceautomatically constructs its subtree if a corresponding Entity is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node. A DOM application may use the DOMImplementation.hasFeature method with parameter values "Core" and "3.0" to determine whether or not this module is supported by the implementation.
Any implementation that conforms to DOM Level 3 or a DOM Level 3 module must conform to the Core module. Please refer to additional information about conformance in this specification. RemoveAttributeNodeRemoves the specified attribute node. If a default value for the removed Attr node is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
If validation occurred while invokingDocument.normalizeDocument(), alluser-determined ID attributes are reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if theAttr.schemaTypeInfo attribute contains an ID type,isId will always return true. Interface CharacterDataThe CharacterData interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to CharacterData, though Text and others do inherit the interface from it.
TextContent of type DOMString, introduced in DOM Level 3This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to. BaseURI of type DOMString, readonly, introduced in DOM Level 3The absolute base URI of this node or null if undefined. If neither of the two determining node is a child node and nodeType is the same for both determining nodes, then an implementation-dependent order between the determining nodes is returned.
This order is stable as long as no nodes of the same nodeType are inserted into or removed from the direct container. This would be the case, for example, when comparing two attributes of the same element, and inserting or removing additional attributes might change the order between existing attributes. The following list describes the specifics for each type of node.ATTRIBUTE_NODEThe ownerElement attribute is set to null and the specified flag is set totrue on the generated Attr. Thedescendants of the source Attr are recursively imported and the resulting nodes reassembled to form the corresponding subtree. XmlVersion of type DOMString, introduced in DOM Level 3An attribute specifying, as part of the XML declaration, the version number of this document. Changing this attribute will affect methods that check for illegal characters in XML names.

























No comments:
Post a Comment
Note: Only a member of this blog may post a comment.