Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gnu.xml.dom.DomNode
gnu.xml.dom.DomNsNode
gnu.xml.dom.DomAttr
As a bit of general advice, only look at attribute modification events through the DOMAttrModified event (sent to the associated element). Implementations are not guaranteed to report other events in the same order, so you're very likely to write nonportable code if you monitor events at the "children of Attr" level.
At this writing, not all attribute modifications will cause the DOMAttrModified event to be triggered ... only the ones using the string methods (setNodeValue, setValue, and Element.setAttribute) to modify those values. That is, if you manipulate those children directly, elements won't get notified that attribute values have changed. The natural fix for that will report other modifications, but won't be able to expose "previous" attribute value; it'll need to be cached or something (at which point why bother using child nodes).
You are strongly advised not to use "children" of any attribute nodes you work with.
Constructor Summary | |
|
Method Summary | |
Object |
|
String |
|
Node |
|
Node |
|
String |
|
Node |
|
String |
|
Element |
|
Node |
|
Node |
|
TypeInfo |
|
boolean |
|
String |
|
boolean |
|
Node |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class gnu.xml.dom.DomNsNode | |
getLocalName , getNamespaceURI , getNodeName , getPrefix , setPrefix |
protected DomAttr(DomDocument owner, String namespaceURI, String name)
Constructs an Attr node associated with the specified document. The "specified" flag is initialized to true, since this DOM has no current "back door" mechanisms to manage default values so that every value must effectively be "specified".This constructor should only be invoked by a Document as part of its createAttribute functionality, or through a subclass which is similarly used in a "Sub-DOM" style layer.
- Parameters:
owner
- The document with which this node is associatednamespaceURI
- Combined with the local part of the name, this is used to uniquely identify a type of attributename
- Name of this attribute, which may include a prefix
public final String getBaseURI()
The base URI of an Attr is alwaysnull
.
- Specified by:
- getBaseURI in interface Node
- Overrides:
- getBaseURI in interface DomNode
public final Node getFirstChild()
The first child of this node. If there is no such node, this returnsnull
.
- Specified by:
- getFirstChild in interface Node
- Overrides:
- getFirstChild in interface DomNode
public final Node getLastChild()
The last child of this node. If there is no such node, this returnsnull
.
- Specified by:
- getLastChild in interface Node
- Overrides:
- getLastChild in interface DomNode
public final String getName()
DOM L1 Returns the attribute name (same as getNodeName)
- Specified by:
- getName in interface Attr
public final Node getNextSibling()
The node immediately following this node. If there is no such node, this returnsnull
.
- Specified by:
- getNextSibling in interface Node
- Overrides:
- getNextSibling in interface DomNode
public String getNodeValue()
DOM L1 Returns the attribute value, with character and entity references substituted. NOTE: entity refs as children aren't currently handled.
- Specified by:
- getNodeValue in interface Node
- Overrides:
- getNodeValue in interface DomNode
public final Element getOwnerElement()
DOM L2 Returns the element with which this attribute is associated.
- Specified by:
- getOwnerElement in interface Attr
public Node getParentNode()
The parent of this node. All nodes, exceptAttr
,Document
,DocumentFragment
,Entity
, andNotation
may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull
.
- Specified by:
- getParentNode in interface Node
- Overrides:
- getParentNode in interface DomNode
public final Node getPreviousSibling()
The node immediately preceding this node. If there is no such node, this returnsnull
.
- Specified by:
- getPreviousSibling in interface Node
- Overrides:
- getPreviousSibling in interface DomNode
public TypeInfo getSchemaTypeInfo()
The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invokingDocument.normalizeDocument()
,schemaTypeInfo
may not be reliable if the node was moved.
- Specified by:
- getSchemaTypeInfo in interface Attr
- Since:
- DOM Level 3
public final boolean getSpecified()
DOM L1 Returns true if a parser reported this was in the source text.
- Specified by:
- getSpecified in interface Attr
public final String getValue()
DOM L1 Returns the value of the attribute as a non-null string; same as getNodeValue. NOTE: entity refs as children aren't currently handled.
- Specified by:
- getValue in interface Attr
public boolean isId()
Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, theownerElement
of this attribute can be retrieved using the methodDocument.getElementById
. The implementation could use several ways to determine if an attribute node is known to contain an identifier:
- If validation occurred using an XML Schema [XML Schema Part 1] while loading the document or while invoking
Document.normalizeDocument()
, the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is a schema-determined ID attribute using the schema-determined ID definition in [XPointer] .- If validation occurred using a DTD while loading the document or while invoking
Document.normalizeDocument()
, the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID attribute using the DTD-determined ID definition in [XPointer] .- from the use of the methods
Element.setIdAttribute()
,Element.setIdAttributeNS()
, orElement.setIdAttributeNode()
, i.e. it is an user-determined ID attribute;Note: XPointer framework (see section 3.2 in [XPointer] ) consider the DOM user-determined ID attribute as being part of the XPointer externally-determined ID definition.
- using mechanisms that are outside the scope of this specification, it is then an externally-determined ID attribute. This includes using schema languages different from XML schema and DTD.
If validation occurred while invokingDocument.normalizeDocument()
, all user-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.
- Since:
- DOM Level 3
public void setNodeValue(String value)
DOM L1 Assigns the attribute value; using this API, no entity or character references will exist. Causes a DOMAttrModified mutation event to be sent.
- Specified by:
- setNodeValue in interface Node
- Overrides:
- setNodeValue in interface DomNode
public final void setOwnerElement(Element e)
Records the element with which this attribute is associated.
public final void setSpecified(boolean value)
Records whether this attribute was in the source text.