IAttr Interface

Definition

The Attr interface represents an attribute in an Element object.

[Android.Runtime.Register("org/w3c/dom/Attr", "", "Org.W3c.Dom.IAttrInvoker")]
public interface IAttr : IDisposable, Java.Interop.IJavaPeerable, Org.W3c.Dom.INode
[<Android.Runtime.Register("org/w3c/dom/Attr", "", "Org.W3c.Dom.IAttrInvoker")>]
type IAttr = interface
    interface INode
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Attributes
Implements

Remarks

The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a schema associated with the document.

Attr objects inherit the Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the Node attributes parentNode, previousSibling, and nextSibling have a null value for Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore, Attr nodes may not be immediate children of a DocumentFragment. However, they can be associated with Element nodes contained within a DocumentFragment. In short, users and implementors of the DOM need to be aware that Attr nodes have some things in common with other objects inheriting the Node interface, but they also are quite distinct.

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the Node.nodeValue attribute on the Attr instance can also be used to retrieve the string version of the attribute's value(s).

If the attribute was not explicitly given a value in the instance document but has a default value provided by the schema associated with the document, an attribute node will be created with specified set to false. Removing attribute nodes for which a default value is defined in the schema generates a new attribute node with the default value and specified set to false. If validation occurred while invoking Document.normalizeDocument(), attribute nodes with specified equals to false are recomputed according to the default attribute values provided by the schema. If no default value is associate with this attribute in the schema, the attribute node is discarded.

In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node may be either Text or EntityReference nodes (when these are in use; see the description of EntityReference for discussion).

The DOM Core represents all attribute values as simple strings, even if the DTD or schema associated with the document declares them of some specific type such as tokenized.

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 (assuming the right options have been set). 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 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.

The following table gives some examples of the relations between the attribute value in the original document (parsed attribute), the value as exposed in the DOM, and the serialization of the value: <table border='1' cellpadding='3'> <tr> <th>Examples</th> <th>Parsed attribute value</th> <th>Initial Attr.value</th> <th>Serialized attribute value</th> </tr> <tr> <td valign='top' rowspan='1' colspan='1'> Character reference</td> <td valign='top' rowspan='1' colspan='1'>

"x&amp;#178;=5"

</td> <td valign='top' rowspan='1' colspan='1'>

"x\u00b2=5"

</td> <td valign='top' rowspan='1' colspan='1'>

"x&amp;#178;=5"

</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Built-in character entity</td> <td valign='top' rowspan='1' colspan='1'>

"y&amp;lt;6"

</td> <td valign='top' rowspan='1' colspan='1'>

"y&lt;6"

</td> <td valign='top' rowspan='1' colspan='1'>

"y&amp;lt;6"

</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Literal newline between</td> <td valign='top' rowspan='1' colspan='1'>

"x=5&amp;#10;y=6"

</td> <td valign='top' rowspan='1' colspan='1'>

"x=5 y=6"

</td> <td valign='top' rowspan='1' colspan='1'>

"x=5&amp;#10;y=6"

</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Normalized newline between</td> <td valign='top' rowspan='1' colspan='1'>

"x=5
            y=6"

</td> <td valign='top' rowspan='1' colspan='1'>

"x=5 y=6"

</td> <td valign='top' rowspan='1' colspan='1'>

"x=5 y=6"

</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Entity e with literal newline</td> <td valign='top' rowspan='1' colspan='1'>

&lt;!ENTITY e '...&amp;#10;...'&gt; [...]&gt; "x=5&amp;e;y=6"

</td> <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load Options</em></td> <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load/Save Options</em></td> </tr> </table>

See also the Document Object Model (DOM) Level 3 Core Specification.

Java documentation for org.w3c.dom.Attr.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

AttributeNode

The node is an Attr.

(Inherited from INode)
CdataSectionNode

The node is a CDATASection.

(Inherited from INode)
CommentNode

The node is a Comment.

(Inherited from INode)
DocumentFragmentNode

The node is a DocumentFragment.

(Inherited from INode)
DocumentNode

The node is a Document.

(Inherited from INode)
DocumentPositionContainedBy

The node is contained by the reference node.

(Inherited from INode)
DocumentPositionContains

The node contains the reference node.

(Inherited from INode)
DocumentPositionDisconnected

The two nodes are disconnected.

(Inherited from INode)
DocumentPositionFollowing

The node follows the reference node.

(Inherited from INode)
DocumentPositionImplementationSpecific

The determination of preceding versus following is implementation-specific.

(Inherited from INode)
DocumentPositionPreceding

The second node precedes the reference node.

(Inherited from INode)
DocumentTypeNode

The node is a DocumentType.

(Inherited from INode)
ElementNode

The node is an Element.

(Inherited from INode)
EntityNode

The node is an Entity.

(Inherited from INode)
EntityReferenceNode

The node is an EntityReference.

(Inherited from INode)
NotationNode

The node is a Notation.

(Inherited from INode)
ProcessingInstructionNode

The node is a ProcessingInstruction.

(Inherited from INode)
TextNode

The node is a Text node.

(Inherited from INode)

Properties

Attributes

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

(Inherited from INode)
BaseURI

The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.

(Inherited from INode)
ChildNodes

A NodeList that contains all children of this node.

(Inherited from INode)
FirstChild

The first child of this node.

(Inherited from INode)
Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
HasAttributes

Returns whether this node (if it is an element) has any attributes.

(Inherited from INode)
HasChildNodes

Returns whether this node has any children.

(Inherited from INode)
IsId

Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.

JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
LastChild

The last child of this node.

(Inherited from INode)
LocalName

Returns the local part of the qualified name of this node.

(Inherited from INode)
Name

Returns the name of this attribute.

NamespaceURI

The namespace URI of this node, or null if it is unspecified (see ).

(Inherited from INode)
NextSibling

The node immediately following this node.

(Inherited from INode)
NodeName

The name of this node, depending on its type; see the table above.

(Inherited from INode)
NodeType

A code representing the type of the underlying object, as defined above.

(Inherited from INode)
NodeValue

The value of this node, depending on its type; see the table above.

(Inherited from INode)
OwnerDocument

The Document object associated with this node.

(Inherited from INode)
OwnerElement

The Element node this attribute is attached to or null if this attribute is not in use.

ParentNode

The parent of this node.

(Inherited from INode)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)
Prefix

The namespace prefix of this node, or null if it is unspecified.

(Inherited from INode)
PreviousSibling

The node immediately preceding this node.

(Inherited from INode)
SchemaTypeInfo

The type information associated with this attribute.

Specified

True if this attribute was explicitly given a value in the instance document, false otherwise.

TextContent

This attribute returns the text content of this node and its descendants.

(Inherited from INode)
Value

On retrieval, the value of the attribute is returned as a string.

Methods

AppendChild(INode)

Adds the node newChild to the end of the list of children of this node.

(Inherited from INode)
CloneNode(Boolean)

Returns a duplicate of this node, i.

(Inherited from INode)
CompareDocumentPosition(INode)

Compares the reference node, i.

(Inherited from INode)
Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
GetFeature(String, String)

This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in .

(Inherited from INode)
GetUserData(String)

Retrieves the object associated to a key on a this node.

(Inherited from INode)
InsertBefore(INode, INode)

Inserts the node newChild before the existing child node refChild.

(Inherited from INode)
IsDefaultNamespace(String)

This method checks if the specified namespaceURI is the default namespace or not.

(Inherited from INode)
IsEqualNode(INode)

Tests whether two nodes are equal.

(Inherited from INode)
IsSameNode(INode)

Returns whether this node is the same node as the given one.

(Inherited from INode)
IsSupported(String, String)

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in .

(Inherited from INode)
LookupNamespaceURI(String)

Look up the namespace URI associated to the given prefix, starting from this node.

(Inherited from INode)
LookupPrefix(String)

Look up the prefix associated to the given namespace URI, starting from this node.

(Inherited from INode)
Normalize()

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.

(Inherited from INode)
RemoveChild(INode)

Removes the child node indicated by oldChild from the list of children, and returns it.

(Inherited from INode)
ReplaceChild(INode, INode)

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

(Inherited from INode)
SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
SetUserData(String, Object, IUserDataHandler)

Associate an object to a key on this node.

(Inherited from INode)
UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to