XML DOM - Attr objects
Attr objects
Attr object represents the Element object properties. The allowable value of the property is usually defined in the DTD.
Since the Attr object is also a Node, it inherits the properties and methods of Node objects. However, the properties can not have a parent node, while the property is not considered a child node of an element, for many Node attribute it will return null.
Attr object properties
属性 | 描述 |
---|---|
baseURI | 返回属性的绝对基准 URI。 |
isId | 如果属性是 ID 类型,则返回 true,否则返回 false。 |
localName | 返回属性名称的本地部分。 |
name | 返回属性的名称。 |
namespaceURI | 返回属性的命名空间 URI。 |
nodeName | 返回节点的名称,根据其类型。 |
nodeType | 返回节点的类型。 |
nodeValue | 设置或返回节点的值,根据其类型。 |
ownerDocument | 返回属性所属的根元素(document 对象)。 |
ownerElement | 返回属性所附属的元素节点。 |
prefix | 设置或返回属性的命名空间前缀。 |
schemaTypeInfo | 返回与属性相关联的类型信息。 |
specified | 如果属性值被设置在文档中,则返回 true,如果其默认值被设置在 DTD/Schema 中,则返回 false。 |
textContent | 设置或返回属性的文本内容。 |
value | 设置或返回属性的值。 |