org.apache.xml.dtm.ref.dom2dtm

Class DOM2DTMdefaultNamespaceDeclarationNode

Implemented Interfaces:
Attr, Node

public class DOM2DTMdefaultNamespaceDeclarationNode
extends java.lang.Object
implements Attr

This is a kluge to let us shove a declaration for xml: into the DOM2DTM model. Basically, it creates a proxy node in DOM space to carry the additional information. This is _NOT_ a full DOM implementation, and shouldn't be one since it sits alongside the DOM rather than becoming part of the DOM model. (This used to be an internal class within DOM2DTM. Moved out because I need to perform an instanceof operation on it to support a temporary workaround in DTMManagerDefault.) %REVIEW% What if the DOM2DTM was built around a DocumentFragment and there isn't a single root element? I think this fails that case... %REVIEW% An alternative solution would be to create the node _only_ in DTM space, but given how DOM2DTM is currently written I think this is simplest.

Nested Class Summary

Fields inherited from interface org.w3c.dom.Node

ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE

Method Summary

Node
appendChild(Node a)
Node
cloneNode(boolean deep)
NamedNodeMap
getAttributes()
NodeList
getChildNodes()
Node
getFirstChild()
int
getHandleOfNode()
Non-DOM method, part of the temporary kluge %REVIEW% This would be a pruning problem, but since it will always be added to the root element and we prune on elements, we shouldn't have to worry.
Node
getLastChild()
String
getLocalName()
String
getName()
Returns the name of this attribute.
String
getNamespaceURI()
Node
getNextSibling()
String
getNodeName()
short
getNodeType()
String
getNodeValue()
Document
getOwnerDocument()
Element
getOwnerElement()
The Element node this attribute is attached to or null if this attribute is not in use.
Node
getParentNode()
String
getPrefix()
Node
getPreviousSibling()
boolean
getSpecified()
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
String
getValue()
On retrieval, the value of the attribute is returned as a string.
boolean
hasAttributes()
boolean
hasChildNodes()
Node
insertBefore(Node a, Node b)
boolean
isSupported(String feature, String version)
void
normalize()
Node
removeChild(Node a)
Node
replaceChild(Node a, Node b)
void
setNodeValue(String value)
void
setPrefix(String value)
void
setValue(String value)
On retrieval, the value of the attribute is returned as a string.

Method Details

appendChild

public Node appendChild(Node a)
Specified by:
appendChild in interface Node


cloneNode

public Node cloneNode(boolean deep)
Specified by:
cloneNode in interface Node


getAttributes

public NamedNodeMap getAttributes()
Specified by:
getAttributes in interface Node


getChildNodes

public NodeList getChildNodes()
Specified by:
getChildNodes in interface Node


getFirstChild

public Node getFirstChild()
Specified by:
getFirstChild in interface Node


getHandleOfNode

public int getHandleOfNode()
Non-DOM method, part of the temporary kluge %REVIEW% This would be a pruning problem, but since it will always be added to the root element and we prune on elements, we shouldn't have to worry.


getLastChild

public Node getLastChild()
Specified by:
getLastChild in interface Node


getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node


getName

public String getName()
Returns the name of this attribute.
Specified by:
getName in interface Attr


getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node


getNextSibling

public Node getNextSibling()
Specified by:
getNextSibling in interface Node


getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node


getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node


getNodeValue

public String getNodeValue()
Specified by:
getNodeValue in interface Node


getOwnerDocument

public Document getOwnerDocument()
Specified by:
getOwnerDocument in interface Node


getOwnerElement

public Element getOwnerElement()
The Element node this attribute is attached to or null if this attribute is not in use.
Specified by:
getOwnerElement in interface Attr

Since:
DOM Level 2


getParentNode

public Node getParentNode()
Specified by:
getParentNode in interface Node


getPrefix

public String getPrefix()
Specified by:
getPrefix in interface Node


getPreviousSibling

public Node getPreviousSibling()
Specified by:
getPreviousSibling in interface Node


getSpecified

public boolean getSpecified()
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then the specified flag is automatically flipped to true. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available with specified set to false and the default value (if one exists).
In summary: If the attribute has an assigned value in the document then specified is true, and the value is the assigned value.If the attribute has no assigned value in the document and has a default value in the DTD, then specified is false, and the value is the default value in the DTD.If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document.If the ownerElement attribute is null (i.e. because it was just created or was set to null by the various removal and cloning operations) specified is true.
Specified by:
getSpecified in interface Attr


getValue

public String getValue()
On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface.
On setting, this creates a Text node with the unparsed contents of the string. I.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method setAttribute on the Element interface.
Specified by:
getValue in interface Attr


hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface Node


hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node


insertBefore

public Node insertBefore(Node a,
                         Node b)
Specified by:
insertBefore in interface Node


isSupported

public boolean isSupported(String feature,
                           String version)
Specified by:
isSupported in interface Node


normalize

public void normalize()
Specified by:
normalize in interface Node


removeChild

public Node removeChild(Node a)
Specified by:
removeChild in interface Node


replaceChild

public Node replaceChild(Node a,
                         Node b)
Specified by:
replaceChild in interface Node


setNodeValue

public void setNodeValue(String value)
Specified by:
setNodeValue in interface Node


setPrefix

public void setPrefix(String value)
Specified by:
setPrefix in interface Node


setValue

public void setValue(String value)
On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface.
On setting, this creates a Text node with the unparsed contents of the string. I.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method setAttribute on the Element interface.
Specified by:
setValue in interface Attr


Copyright B) 2004 Apache XML Project. All Rights Reserved.