Java Doc for ParentNode.java in  » Web-Server » Rimfaxe-Web-Server » org » apache » xerces » dom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Rimfaxe Web Server » org.apache.xerces.dom 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.xerces.dom.NodeImpl
      org.apache.xerces.dom.ChildNode
         org.apache.xerces.dom.ParentNode

All known Subclasses:   org.apache.xerces.dom.ElementDefinitionImpl,  org.apache.xerces.dom.DocumentFragmentImpl,  org.apache.xerces.dom.EntityImpl,  org.apache.xerces.dom.ElementImpl,  org.apache.xerces.dom.DocumentTypeImpl,  org.apache.xerces.dom.CoreDocumentImpl,  org.apache.xerces.dom.EntityReferenceImpl,
ParentNode
abstract public class ParentNode extends ChildNode (Code)
ParentNode inherits from ChildNode and adds the capability of having child nodes. Not every node in the DOM can have children, so only nodes that can should inherit from this class and pay the price for it.

ParentNode, just like NodeImpl, also implements NodeList, so it can return itself in response to the getChildNodes() query. This eliminiates the need for a separate ChildNodeList object. Note that this is an IMPLEMENTATION DETAIL; applications should _never_ assume that this identity exists. On the other hand, subclasses may need to override this, in case of conflicting names. This is the case for the classes HTMLSelectElementImpl and HTMLFormElementImpl of the HTML DOM.

While we have a direct reference to the first child, the last child is stored as the previous sibling of the first child. First child nodes are marked as being so, and getNextSibling hides this fact.

Note: Not all parent nodes actually need to also be a child. At some point we used to have ParentNode inheriting from NodeImpl and another class called ChildAndParentNode that inherited from ChildNode. But due to the lack of multiple inheritance a lot of code had to be duplicated which led to a maintenance nightmare. At the same time only a few nodes (Document, DocumentFragment, Entity, and Attribute) cannot be a child so the gain in memory wasn't really worth it. The only type for which this would be the case is Attribute, but we deal with there in another special way, so this is not applicable.

This class doesn't directly support mutation events, however, it notifies the document when mutations are performed so that the document class do so.

WARNING: Some of the code here is partially duplicated in AttrImpl, be careful to keep these two classes in sync!
author:
   Arnaud Le Hors, IBM
author:
   Joe Kesselman, IBM
author:
   Andy Clark, IBM



Field Summary
protected transient  ChildNodefCachedChild
     Last requested node.
protected transient  intfCachedChildIndex
     Last requested node index.
protected transient  intfCachedLength
     Cached node list length.
protected  ChildNodefirstChild
     First child.
protected  CoreDocumentImplownerDocument
     Owner document.
final static  longserialVersionUID
     Serialization version.

Constructor Summary
protected  ParentNode(CoreDocumentImpl ownerDocument)
    
public  ParentNode()
     Constructor for serialization.

Method Summary
 voidcheckNormalizationAfterInsert(ChildNode insertedChild)
     Checks the normalized state of this node after inserting a child.
 voidcheckNormalizationAfterRemove(ChildNode previousSibling)
     Checks the normalized of this node after removing a child.
public  NodecloneNode(boolean deep)
     Returns a duplicate of a given node.
public  NodeListgetChildNodes()
     Obtain a NodeList enumerating all children of this node.
final protected  NodeListgetChildNodesUnoptimized()
     Create a NodeList to access children that is use by subclass elements that have methods named getLength() or item(int).
public  NodegetFirstChild()
     The first child of this Node, or null if none.
public  NodegetLastChild()
     The last child of this Node, or null if none.
public  intgetLength()
    
public  DocumentgetOwnerDocument()
     Find the Document that this Node belongs to (the document in whose context the Node was created).
public  booleanhasChildNodes()
     Test whether this node has any children.
public  NodeinsertBefore(Node newChild, Node refChild)
     Move one or more node(s) to our list of children.
 NodeinternalInsertBefore(Node newChild, Node refChild, boolean replace)
     NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned.
 NodeinternalRemoveChild(Node oldChild, boolean replace)
     NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned.
public  Nodeitem(int index)
     NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.
final  ChildNodelastChild()
    
final  voidlastChild(ChildNode node)
    
public  voidnormalize()
     Override default behavior to call normalize() on this Node's children.
 CoreDocumentImplownerDocument()
    
public  NoderemoveChild(Node oldChild)
     Remove a child from this Node.
public  NodereplaceChild(Node newChild, Node oldChild)
     Make newChild occupy the location that oldChild used to have.
 voidsetOwnerDocument(CoreDocumentImpl doc)
    
public  voidsetReadOnly(boolean readOnly, boolean deep)
     Override default behavior so that if deep is true, children are also toggled.
protected  voidsynchronizeChildren()
     Override this method in subclass to hook in efficient internal data structure.

Field Detail
fCachedChild
protected transient ChildNode fCachedChild(Code)
Last requested node.



fCachedChildIndex
protected transient int fCachedChildIndex(Code)
Last requested node index.



fCachedLength
protected transient int fCachedLength(Code)
Cached node list length.



firstChild
protected ChildNode firstChild(Code)
First child.



ownerDocument
protected CoreDocumentImpl ownerDocument(Code)
Owner document.



serialVersionUID
final static long serialVersionUID(Code)
Serialization version.




Constructor Detail
ParentNode
protected ParentNode(CoreDocumentImpl ownerDocument)(Code)
No public constructor; only subclasses of ParentNode should be instantiated, and those normally via a Document's factory methods



ParentNode
public ParentNode()(Code)
Constructor for serialization.




Method Detail
checkNormalizationAfterInsert
void checkNormalizationAfterInsert(ChildNode insertedChild)(Code)
Checks the normalized state of this node after inserting a child. If the inserted child causes this node to be unnormalized, then this node is flagged accordingly. The conditions for changing the normalized state are:
  • The inserted child is a text node and one of its adjacent siblings is also a text node.
  • The inserted child is is itself unnormalized.

Parameters:
  insertedChild - the child node that was inserted into this node
throws:
  NullPointerException - if the inserted child is null



checkNormalizationAfterRemove
void checkNormalizationAfterRemove(ChildNode previousSibling)(Code)
Checks the normalized of this node after removing a child. If the removed child causes this node to be unnormalized, then this node is flagged accordingly. The conditions for changing the normalized state are:
  • The removed child had two adjacent siblings that were text nodes.

Parameters:
  previousSibling - the previous sibling of the removed child, ornull



cloneNode
public Node cloneNode(boolean deep)(Code)
Returns a duplicate of a given node. You can consider this a generic "copy constructor" for nodes. The newly returned object should be completely independent of the source object's subtree, so changes in one after the clone has been made will not affect the other.

Example: Cloning a Text node will copy both the node and the text it contains.

Example: Cloning something that has children -- Element or Attr, for example -- will _not_ clone those children unless a "deep clone" has been requested. A shallow clone of an Attr node will yield an empty Attr of the same name.

NOTE: Clones will always be read/write, even if the node being cloned is read-only, to permit applications using only the DOM API to obtain editable copies of locked portions of the tree.




getChildNodes
public NodeList getChildNodes()(Code)
Obtain a NodeList enumerating all children of this node. If there are none, an (initially) empty NodeList is returned.

NodeLists are "live"; as children are added/removed the NodeList will immediately reflect those changes. Also, the NodeList refers to the actual nodes, so changes to those nodes made via the DOM tree will be reflected in the NodeList and vice versa.

In this implementation, Nodes implement the NodeList interface and provide their own getChildNodes() support. Other DOMs may solve this differently.




getChildNodesUnoptimized
final protected NodeList getChildNodesUnoptimized()(Code)
Create a NodeList to access children that is use by subclass elements that have methods named getLength() or item(int). ChildAndParentNode optimizes getChildNodes() by implementing NodeList itself. However if a subclass Element implements methods with the same name as the NodeList methods, they will override the actually methods in this class.

To use this method, the subclass should implement getChildNodes() and have it call this method. The resulting NodeList instance maybe shared and cached in a transient field, but the cached value must be cleared if the node is cloned.




getFirstChild
public Node getFirstChild()(Code)
The first child of this Node, or null if none.



getLastChild
public Node getLastChild()(Code)
The last child of this Node, or null if none.



getLength
public int getLength()(Code)
NodeList method: Count the immediate children of this node int



getOwnerDocument
public Document getOwnerDocument()(Code)
Find the Document that this Node belongs to (the document in whose context the Node was created). The Node may or may not currently be part of that Document's actual contents.



hasChildNodes
public boolean hasChildNodes()(Code)
Test whether this node has any children. Convenience shorthand for (Node.getFirstChild()!=null)



insertBefore
public Node insertBefore(Node newChild, Node refChild) throws DOMException(Code)
Move one or more node(s) to our list of children. Note that this implicitly removes them from their previous parent.
Parameters:
  newChild - The Node to be moved to our subtree. As aconvenience feature, inserting a DocumentNode will instead insertall its children.
Parameters:
  refChild - Current child which newChild should be placedimmediately before. If refChild is null, the insertion occursafter all existing Nodes, like appendChild().
throws:
  DOMException - (HIERARCHY_REQUEST_ERR) if newChild is of atype that shouldn't be a child of this node, or if newChild is anancestor of this node.
throws:
  DOMException - (WRONG_DOCUMENT_ERR) if newChild has adifferent owner document than we do.
throws:
  DOMException - (NOT_FOUND_ERR) if refChild is not a child ofthis node.
throws:
  DOMException - (NO_MODIFICATION_ALLOWED_ERR) if this node isread-only.



internalInsertBefore
Node internalInsertBefore(Node newChild, Node refChild, boolean replace) throws DOMException(Code)
NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned. This version of the insertBefore operation allows us to do so. It is not intended for use by application programs.



internalRemoveChild
Node internalRemoveChild(Node oldChild, boolean replace) throws DOMException(Code)
NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able to control which mutation events are spawned. This version of the removeChild operation allows us to do so. It is not intended for use by application programs.



item
public Node item(int index)(Code)
NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds. org.w3c.dom.Node
Parameters:
  index - int



lastChild
final ChildNode lastChild()(Code)



lastChild
final void lastChild(ChildNode node)(Code)



normalize
public void normalize()(Code)
Override default behavior to call normalize() on this Node's children. It is up to implementors or Node to override normalize() to take action.



ownerDocument
CoreDocumentImpl ownerDocument()(Code)
same as above but returns internal type and this one is not overridden by CoreDocumentImpl to return null



removeChild
public Node removeChild(Node oldChild) throws DOMException(Code)
Remove a child from this Node. The removed child's subtree remains intact so it may be re-inserted elsewhere. oldChild, in its new state (removed).
throws:
  DOMException - (NOT_FOUND_ERR) if oldChild is not a child ofthis node.
throws:
  DOMException - (NO_MODIFICATION_ALLOWED_ERR) if this node isread-only.



replaceChild
public Node replaceChild(Node newChild, Node oldChild) throws DOMException(Code)
Make newChild occupy the location that oldChild used to have. Note that newChild will first be removed from its previous parent, if any. Equivalent to inserting newChild before oldChild, then removing oldChild.
throws:
  DOMException - (HIERARCHY_REQUEST_ERR) if newChild is of atype that shouldn't be a child of this node, or if newChild isone of our ancestors.
throws:
  DOMException - (WRONG_DOCUMENT_ERR) if newChild has adifferent owner document than we do.
throws:
  DOMException - (NOT_FOUND_ERR) if oldChild is not a child ofthis node.
throws:
  DOMException - (NO_MODIFICATION_ALLOWED_ERR) if this node isread-only.



setOwnerDocument
void setOwnerDocument(CoreDocumentImpl doc)(Code)
NON-DOM set the ownerDocument of this node and its children



setReadOnly
public void setReadOnly(boolean readOnly, boolean deep)(Code)
Override default behavior so that if deep is true, children are also toggled.
See Also:   Node
See Also:   


See Also:   Note: this will not change the state of an EntityReference or its
See Also:   children, which are always read-only.




synchronizeChildren
protected void synchronizeChildren()(Code)
Override this method in subclass to hook in efficient internal data structure.



Fields inherited from org.apache.xerces.dom.ChildNode
protected ChildNode nextSibling(Code)(Java Doc)
protected ChildNode previousSibling(Code)(Java Doc)
final static long serialVersionUID(Code)(Java Doc)

Methods inherited from org.apache.xerces.dom.ChildNode
public Node cloneNode(boolean deep)(Code)(Java Doc)
public Node getNextSibling()(Code)(Java Doc)
public Node getParentNode()(Code)(Java Doc)
public Node getPreviousSibling()(Code)(Java Doc)
final NodeImpl parentNode()(Code)(Java Doc)
final ChildNode previousSibling()(Code)(Java Doc)

Fields inherited from org.apache.xerces.dom.NodeImpl
final public static short ELEMENT_DEFINITION_NODE(Code)(Java Doc)
final protected static short FIRSTCHILD(Code)(Java Doc)
final protected static short HASSTRING(Code)(Java Doc)
final protected static short IGNORABLEWS(Code)(Java Doc)
final protected static short OWNED(Code)(Java Doc)
final protected static short READONLY(Code)(Java Doc)
final protected static short SPECIFIED(Code)(Java Doc)
final protected static short SYNCCHILDREN(Code)(Java Doc)
final protected static short SYNCDATA(Code)(Java Doc)
final protected static short UNNORMALIZED(Code)(Java Doc)
protected short flags(Code)(Java Doc)
protected NodeImpl ownerNode(Code)(Java Doc)
final static long serialVersionUID(Code)(Java Doc)

Methods inherited from org.apache.xerces.dom.NodeImpl
public void addEventListener(String type, EventListener listener, boolean useCapture)(Code)(Java Doc)
public Node appendChild(Node newChild) throws DOMException(Code)(Java Doc)
protected void changed()(Code)(Java Doc)
protected int changes()(Code)(Java Doc)
public Node cloneNode(boolean deep)(Code)(Java Doc)
public boolean dispatchEvent(Event event)(Code)(Java Doc)
public NamedNodeMap getAttributes()(Code)(Java Doc)
public NodeList getChildNodes()(Code)(Java Doc)
public Node getFirstChild()(Code)(Java Doc)
public Node getLastChild()(Code)(Java Doc)
public int getLength()(Code)(Java Doc)
public String getLocalName()(Code)(Java Doc)
public String getNamespaceURI()(Code)(Java Doc)
public Node getNextSibling()(Code)(Java Doc)
abstract public String getNodeName()(Code)(Java Doc)
abstract public short getNodeType()(Code)(Java Doc)
public String getNodeValue()(Code)(Java Doc)
public Document getOwnerDocument()(Code)(Java Doc)
public Node getParentNode()(Code)(Java Doc)
public String getPrefix()(Code)(Java Doc)
public Node getPreviousSibling()(Code)(Java Doc)
public boolean getReadOnly()(Code)(Java Doc)
public Object getUserData()(Code)(Java Doc)
public boolean hasAttributes()(Code)(Java Doc)
public boolean hasChildNodes()(Code)(Java Doc)
final boolean hasStringValue()(Code)(Java Doc)
final void hasStringValue(boolean value)(Code)(Java Doc)
public Node insertBefore(Node newChild, Node refChild) throws DOMException(Code)(Java Doc)
final boolean internalIsIgnorableWhitespace()(Code)(Java Doc)
final boolean isFirstChild()(Code)(Java Doc)
final void isFirstChild(boolean value)(Code)(Java Doc)
final void isIgnorableWhitespace(boolean value)(Code)(Java Doc)
final boolean isNormalized()(Code)(Java Doc)
final void isNormalized(boolean value)(Code)(Java Doc)
final boolean isOwned()(Code)(Java Doc)
final void isOwned(boolean value)(Code)(Java Doc)
final boolean isReadOnly()(Code)(Java Doc)
final void isReadOnly(boolean value)(Code)(Java Doc)
final boolean isSpecified()(Code)(Java Doc)
final void isSpecified(boolean value)(Code)(Java Doc)
public boolean isSupported(String feature, String version)(Code)(Java Doc)
public Node item(int index)(Code)(Java Doc)
final boolean needsSyncChildren()(Code)(Java Doc)
final void needsSyncChildren(boolean value)(Code)(Java Doc)
final boolean needsSyncData()(Code)(Java Doc)
final void needsSyncData(boolean value)(Code)(Java Doc)
public void normalize()(Code)(Java Doc)
CoreDocumentImpl ownerDocument()(Code)(Java Doc)
NodeImpl parentNode()(Code)(Java Doc)
ChildNode previousSibling()(Code)(Java Doc)
public Node removeChild(Node oldChild) throws DOMException(Code)(Java Doc)
public void removeEventListener(String type, EventListener listener, boolean useCapture)(Code)(Java Doc)
public Node replaceChild(Node newChild, Node oldChild) throws DOMException(Code)(Java Doc)
public void setNodeValue(String x) throws DOMException(Code)(Java Doc)
void setOwnerDocument(CoreDocumentImpl doc)(Code)(Java Doc)
public void setPrefix(String prefix) throws DOMException(Code)(Java Doc)
public void setReadOnly(boolean readOnly, boolean deep)(Code)(Java Doc)
public void setUserData(Object data)(Code)(Java Doc)
protected void synchronizeData()(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.