|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.caja.parser.html.Nodes
public class Nodes
Utilities for dealing with HTML/XML DOM trees.
Field Summary | |
---|---|
private static java.lang.String |
FP_KEY
|
private static java.lang.String |
RAW_TEXT_KEY
|
private static FilePosition |
UNKNOWN_START_OF_FILE
|
Constructor Summary | |
---|---|
private |
Nodes()
|
Method Summary | ||
---|---|---|
static java.lang.Iterable<? extends org.w3c.dom.Attr> |
attributesOf(org.w3c.dom.Element el)
An Iterable over the attributes of the given element. |
|
static java.lang.Iterable<? extends org.w3c.dom.Node> |
childrenOf(org.w3c.dom.Node n)
A left to right Iterable over the children of the given node. |
|
static java.lang.String |
decode(java.lang.String html)
Replace entity references in HTML CDATA with their plain text equivalents. |
|
static java.lang.String |
encode(java.lang.String raw)
Convert HTML to plain text by replacing HTML special characters with HTML entities. |
|
static FilePosition |
getFilePositionFor(org.w3c.dom.Node node)
Returns the last file position associated with the given node by setFilePositionFor(org.w3c.dom.Node, com.google.caja.lexer.FilePosition) or related methods. |
|
static FilePosition |
getFilePositionForValue(org.w3c.dom.Attr a)
The file position of the value of the given attribute. |
|
static java.lang.String |
getRawText(org.w3c.dom.Text cd)
|
|
static java.lang.String |
getRawValue(org.w3c.dom.Attr a)
|
|
static
|
nodeListIterable(org.w3c.dom.NodeList nl,
java.lang.Class<? extends T> outType)
An Iterable over the elements of the given node list. |
|
static java.lang.String |
render(org.w3c.dom.Node node)
|
|
static java.lang.String |
render(org.w3c.dom.Node node,
boolean asXml)
Deprecated. |
|
static java.lang.String |
render(org.w3c.dom.Node node,
MarkupRenderMode renderMode)
|
|
static void |
render(org.w3c.dom.Node node,
Namespaces ns,
RenderContext rc)
Serializes the given DOM node to HTML or XML. |
|
static void |
render(org.w3c.dom.Node node,
RenderContext rc)
Serializes the given DOM node to HTML or XML. |
|
static void |
setFilePositionFor(org.w3c.dom.Node node,
FilePosition pos)
|
|
static void |
setFilePositionForValue(org.w3c.dom.Attr a,
FilePosition pos)
|
|
static void |
setRawText(org.w3c.dom.Text cd,
java.lang.String html)
Associates the HTML textual value as parsed with the given node. |
|
static void |
setRawValue(org.w3c.dom.Attr a,
java.lang.String html)
Associates the HTML textual value as parsed with the given attribute. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String FP_KEY
private static final java.lang.String RAW_TEXT_KEY
private static final FilePosition UNKNOWN_START_OF_FILE
Constructor Detail |
---|
private Nodes()
Method Detail |
---|
public static java.lang.Iterable<? extends org.w3c.dom.Node> childrenOf(org.w3c.dom.Node n)
Iterable
over the children of the given node.
public static java.lang.Iterable<? extends org.w3c.dom.Attr> attributesOf(org.w3c.dom.Element el)
Iterable
over the attributes of the given element.
public static <T extends org.w3c.dom.Node> java.lang.Iterable<T> nodeListIterable(org.w3c.dom.NodeList nl, java.lang.Class<? extends T> outType)
Iterable
over the elements of the given node list.
java.lang.ClassCastException
- if a member is fetched that is not an instance
of outType/public static FilePosition getFilePositionFor(org.w3c.dom.Node node)
setFilePositionFor(org.w3c.dom.Node, com.google.caja.lexer.FilePosition)
or related methods.
public static FilePosition getFilePositionForValue(org.w3c.dom.Attr a)
public static void setFilePositionFor(org.w3c.dom.Node node, FilePosition pos)
getFilePositionFor(org.w3c.dom.Node)
public static void setFilePositionForValue(org.w3c.dom.Attr a, FilePosition pos)
public static void setRawValue(org.w3c.dom.Attr a, java.lang.String html)
Node.setNodeValue(String)
or an alias
since parsing, the output should not be trusted.
public static java.lang.String getRawValue(org.w3c.dom.Attr a)
setRawValue(org.w3c.dom.Attr, java.lang.String)
public static void setRawText(org.w3c.dom.Text cd, java.lang.String html)
Node.setNodeValue(String)
or an alias
since parsing, the output should not be trusted.
public static java.lang.String getRawText(org.w3c.dom.Text cd)
setRawText(org.w3c.dom.Text, java.lang.String)
public static java.lang.String decode(java.lang.String html)
public static java.lang.String encode(java.lang.String raw)
public static void render(org.w3c.dom.Node node, Namespaces ns, RenderContext rc)
rc
- a context where the token consumer is typically a
Concatenator
, and the RenderContext.asXml()
is significant.public static void render(org.w3c.dom.Node node, RenderContext rc)
rc
- a context where the token consumer is typically a
Concatenator
, and the RenderContext.asXml()
is significant.public static java.lang.String render(org.w3c.dom.Node node)
@Deprecated public static java.lang.String render(org.w3c.dom.Node node, boolean asXml)
public static java.lang.String render(org.w3c.dom.Node node, MarkupRenderMode renderMode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |