|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsoup.nodes.Node
public abstract class Node
The base, abstract Node model. Elements, Documents, Comments etc are all Node instances.
| Constructor Summary | |
|---|---|
protected |
Node(String baseUri)
|
protected |
Node(String baseUri,
Attributes attributes)
Create a new Node. |
| Method Summary | ||
|---|---|---|
String |
absUrl(String attributeKey)
Get an absolute URL from a URL attribute that may be relative (i.e. |
|
protected void |
addChild(Node in)
|
|
String |
attr(String attributeKey)
Get an attribute's value by its key. |
|
Node |
attr(String attributeKey,
String attributeValue)
Set an attribute (key=value). |
|
Attributes |
attributes()
Get all of the element's attributes. |
|
String |
baseUri()
Get the base URI of this node. |
|
Node |
childNode(int index)
Get a child node by index |
|
List<Node> |
childNodes()
Get this node's children. |
|
boolean |
equals(Object o)
|
|
boolean |
hasAttr(String attributeKey)
Test if this element has an attribute. |
|
int |
hashCode()
|
|
protected void |
indent(StringBuilder accum)
|
|
protected static
|
indexInList(N search,
List<N> nodes)
|
|
Node |
nextSibling()
Get this node's next sibling. |
|
protected int |
nodeDepth()
|
|
abstract String |
nodeName()
Get the node name of this node. |
|
String |
outerHtml()
Get the outer HTML of this node. |
|
Node |
parent()
Gets this node's parent node. |
|
Node |
previousSibling()
Get this node's previous sibling. |
|
Node |
removeAttr(String attributeKey)
Remove an attribute from this element. |
|
protected void |
removeChild(Node out)
|
|
protected void |
replaceChild(Node out,
Node in)
|
|
void |
setBaseUri(String baseUri)
Update the base URI of this node. |
|
protected void |
setParentNode(Node parentNode)
|
|
Integer |
siblingIndex()
Get the list index of this node in its node sibling list. |
|
List<Node> |
siblingNodes()
Retrieves this node's sibling nodes. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Node(String baseUri,
Attributes attributes)
baseUri - base URIattributes - attributes (not null, but may be empty)protected Node(String baseUri)
| Method Detail |
|---|
public abstract String nodeName()
public String attr(String attributeKey)
abs,
which is a shortcut to the absUrl(java.lang.String) method.
E.g.: String url = a.attr("abs:href");
attributeKey - The attribute key.
attributes(),
hasAttr(String),
absUrl(String)public Attributes attributes()
public Node attr(String attributeKey,
String attributeValue)
attributeKey - The attribute key.attributeValue - The attribute value.
public boolean hasAttr(String attributeKey)
attributeKey - The attribute key to check.
public Node removeAttr(String attributeKey)
attributeKey - The attribute to remove.
public String baseUri()
public void setBaseUri(String baseUri)
baseUri - base URI to setpublic String absUrl(String attributeKey)
<a href> or
<img src>.
If the attribute value is already absolute (i.e. it starts with a protocol, like
http:// or https:// etc), and it successfully parses as a URL, the attribute is
returned directly. Otherwise, it is treated as a URL relative to the element's baseUri, and made
absolute using that.
As an alternate, you can use the attr(java.lang.String) method with the abs: prefix.
attributeKey - The attribute key
attr(java.lang.String),
URL.URL(java.net.URL, String)public Node childNode(int index)
index - index of child node
public List<Node> childNodes()
public Node parent()
protected void setParentNode(Node parentNode)
protected void replaceChild(Node out,
Node in)
protected void removeChild(Node out)
protected void addChild(Node in)
protected int nodeDepth()
public List<Node> siblingNodes()
node.parent.childNodes().
public Node nextSibling()
public Node previousSibling()
public Integer siblingIndex()
Element.elementSiblingIndex()
protected static <N extends Node> Integer indexInList(N search,
List<N> nodes)
public String outerHtml()
public String toString()
toString in class Objectprotected void indent(StringBuilder accum)
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||