|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.html.DomNode
public abstract class DomNode
Base class for nodes in the HTML DOM tree. This class is modeled after the W3C DOM specification, but does not implement it.
Field Summary | |
---|---|
static java.lang.String |
PROPERTY_ELEMENT
The name of the "element" property. |
static java.lang.String |
READY_STATE_COMPLETE
A ready state constant for IE (state 5). |
static java.lang.String |
READY_STATE_INTERACTIVE
A ready state constant for IE (state 4). |
static java.lang.String |
READY_STATE_LOADED
A ready state constant for IE (state 3). |
static java.lang.String |
READY_STATE_LOADING
A ready state constant for IE (state 2). |
static java.lang.String |
READY_STATE_UNINITIALIZED
A ready state constant for IE (state 1). |
Method Summary | |
---|---|
void |
addDomChangeListener(DomChangeListener listener)
Adds a DomChangeListener to the listener list. |
DomNode |
appendDomChild(DomNode node)
append a child node to the end of the current list |
java.lang.String |
asText()
Returns a text representation of this element that represents what would be visible to the user if this page was shown in a web browser. |
java.lang.String |
asXml()
Return a string representation of the xml document from this element and all it's children (recursively). |
DomNode |
cloneDomNode(boolean deep)
Make a clone of this node |
java.util.Iterator |
getAllHtmlChildElements()
Return an iterator that will recursively iterate over every child element below this one. |
java.util.List |
getByXPath(java.lang.String xpathExpr)
Facility to evaluate an xpath from the current node. |
java.util.Iterator |
getChildIterator()
|
int |
getEndColumnNumber()
Get the column number in the source page where the DOM node ends. |
int |
getEndLineNumber()
Get the line number in the source page where the DOM node ends. |
org.mozilla.javascript.Function |
getEventHandler(java.lang.String eventName)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
DomNode |
getFirstDomChild()
|
DomNode |
getLastDomChild()
Get the last child DomNode. |
DomNode |
getNextDomSibling()
|
abstract java.lang.String |
getNodeName()
Get the name for the current node. |
abstract short |
getNodeType()
Get the type of the current node. |
java.lang.String |
getNodeValue()
Get the value for the current node. |
HtmlPage |
getPage()
Return the HtmlPage that contains this node |
DomNode |
getParentDomNode()
|
DomNode |
getPreviousDomSibling()
|
java.lang.String |
getReadyState()
Return this node's ready state (IE only). |
org.mozilla.javascript.ScriptableObject |
getScriptObject()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
int |
getStartColumnNumber()
Get the column number in the source page where the DOM node starts. |
int |
getStartLineNumber()
Get the line number in the source page where the DOM node starts. |
void |
insertBefore(DomNode newNode)
Inserts a new child node before this node into the child relationship this node is a part of. |
void |
remove()
remove this node from all relationships this node has with siblings an parents |
void |
removeAllChildren()
Remove all the children of this node. |
void |
removeDomChangeListener(DomChangeListener listener)
Removes an DomChangeListener from the listener list. |
void |
removeEventHandler(java.lang.String eventName)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
void |
replace(DomNode newNode)
Replaces this node with another node. |
void |
setEventHandler(java.lang.String eventName,
org.mozilla.javascript.Function eventHandler)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
void |
setEventHandler(java.lang.String eventName,
java.lang.String jsSnippet)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
void |
setNodeValue(java.lang.String x)
|
void |
setReadyState(java.lang.String state)
Sets this node's ready state (IE only). |
void |
setScriptObject(org.mozilla.javascript.ScriptableObject scriptObject)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROPERTY_ELEMENT
public static final java.lang.String READY_STATE_COMPLETE
public static final java.lang.String READY_STATE_INTERACTIVE
public static final java.lang.String READY_STATE_LOADED
public static final java.lang.String READY_STATE_LOADING
public static final java.lang.String READY_STATE_UNINITIALIZED
Method Detail |
---|
public void addDomChangeListener(DomChangeListener listener)
listener
- the dom structure change listener to be added.removeDomChangeListener(DomChangeListener)
public DomNode appendDomChild(DomNode node)
node
- the node to append
public java.lang.String asText()
public java.lang.String asXml()
public DomNode cloneDomNode(boolean deep)
deep
- if true
, the clone will be propagated to the whole subtree
below this one. Otherwise, the new node will not have any children. The page reference
will always be the same as this node's.
public java.util.Iterator getAllHtmlChildElements()
public java.util.List getByXPath(java.lang.String xpathExpr) throws org.jaxen.JaxenException
xpathExpr
- the xpath expression
XPath#selectNodes(Object)
org.jaxen.JaxenException
- if the xpath expression can't be parsed/evaluatedpublic java.util.Iterator getChildIterator()
public int getEndColumnNumber()
public int getEndLineNumber()
public org.mozilla.javascript.Function getEventHandler(java.lang.String eventName)
eventName
- Name of event such as "onclick" or "onblur", etc.
public DomNode getFirstDomChild()
public DomNode getLastDomChild()
public DomNode getNextDomSibling()
public abstract java.lang.String getNodeName()
public abstract short getNodeType()
public java.lang.String getNodeValue()
public HtmlPage getPage()
public DomNode getParentDomNode()
null
if this
is the root nodepublic DomNode getPreviousDomSibling()
null
if this is
the first nodepublic java.lang.String getReadyState()
public org.mozilla.javascript.ScriptableObject getScriptObject()
public int getStartColumnNumber()
public int getStartLineNumber()
public void insertBefore(DomNode newNode) throws java.lang.IllegalStateException
newNode
- the new node to insert
java.lang.IllegalStateException
- if this node is not a child of any other nodepublic void remove() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this node is not a child of any other nodepublic void removeAllChildren()
public void removeDomChangeListener(DomChangeListener listener)
listener
- the dom structure change listener to be removed.addDomChangeListener(DomChangeListener)
public void removeEventHandler(java.lang.String eventName)
eventName
- Name of the event such as "onclick" or "onblur", etc.public void replace(DomNode newNode) throws java.lang.IllegalStateException
newNode
- the node to replace this one
java.lang.IllegalStateException
- if this node is not a child of any other nodepublic void setEventHandler(java.lang.String eventName, org.mozilla.javascript.Function eventHandler)
eventName
- Name of event such as "onclick" or "onblur", etc.eventHandler
- A rhino javascript executable Functionpublic void setEventHandler(java.lang.String eventName, java.lang.String jsSnippet)
eventName
- Name of event such as "onclick" or "onblur", etc.jsSnippet
- executable javascript codepublic void setNodeValue(java.lang.String x)
x
- The new valuepublic void setReadyState(java.lang.String state)
state
- This node's ready state.public void setScriptObject(org.mozilla.javascript.ScriptableObject scriptObject)
scriptObject
- The javascript object.
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |