public class DocumentType extends Node
<!DOCTYPE> node.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PUBLIC_KEY |
static java.lang.String |
SYSTEM_KEY |
| Constructor and Description |
|---|
DocumentType(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Create a new doctype element.
|
DocumentType(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseUri)
Deprecated.
|
DocumentType(java.lang.String name,
java.lang.String pubSysKey,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseUri)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
absUrl(java.lang.String key)
Get an absolute URL from a URL attribute that may be relative (i.e.
|
java.lang.String |
attr(java.lang.String key)
Get an attribute's value by its key.
|
Node |
attr(java.lang.String key,
java.lang.String value)
Set an attribute (key=value).
|
Attributes |
attributes()
Get all of the element's attributes.
|
java.lang.String |
baseUri()
Get the base URI of this node.
|
int |
childNodeSize()
Get the number of child nodes that this node holds.
|
protected void |
doSetBaseUri(java.lang.String baseUri)
Set the baseUri for just this node (not its descendants), if this Node tracks base URIs.
|
protected java.util.List<Node> |
ensureChildNodes() |
boolean |
hasAttr(java.lang.String key)
Test if this element has an attribute.
|
protected boolean |
hasAttributes()
Check if this Node has an actual Attributes object.
|
java.lang.String |
nodeName()
Get the node name of this node.
|
Node |
removeAttr(java.lang.String key)
Remove an attribute from this element.
|
void |
setPubSysKey(java.lang.String value) |
addChildren, addChildren, after, after, before, before, childNode, childNodes, childNodesAsArray, childNodesCopy, clearAttributes, clone, doClone, equals, filter, hasParent, hasSameValue, html, indent, nextSibling, outerHtml, outerHtml, ownerDocument, parent, parentNode, previousSibling, remove, removeChild, reparentChild, replaceChild, replaceWith, root, setBaseUri, setParentNode, setSiblingIndex, shallowClone, siblingIndex, siblingNodes, toString, traverse, unwrap, wrappublic static final java.lang.String PUBLIC_KEY
public static final java.lang.String SYSTEM_KEY
public DocumentType(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
name - the doctype's namepublicId - the doctype's public IDsystemId - the doctype's system IDpublic DocumentType(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseUri)
name - the doctype's namepublicId - the doctype's public IDsystemId - the doctype's system IDbaseUri - unusedpublic DocumentType(java.lang.String name,
java.lang.String pubSysKey,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseUri)
name - the doctype's namepublicId - the doctype's public IDsystemId - the doctype's system IDbaseUri - unusedpublic void setPubSysKey(java.lang.String value)
public java.lang.String nodeName()
Nodeprotected final boolean hasAttributes()
NodehasAttributes in class Nodepublic final Attributes attributes()
Nodeattributes in class Nodepublic java.lang.String attr(java.lang.String key)
Node
To get an absolute URL from an attribute that may be a relative URL, prefix the key with abs,
which is a shortcut to the Node.absUrl(java.lang.String) method.
String url = a.attr("abs:href");attr in class Nodekey - The attribute key.Node.attributes(),
Node.hasAttr(String),
Node.absUrl(String)public Node attr(java.lang.String key, java.lang.String value)
Nodepublic boolean hasAttr(java.lang.String key)
Nodepublic Node removeAttr(java.lang.String key)
NoderemoveAttr in class Nodekey - The attribute to remove.public java.lang.String absUrl(java.lang.String key)
Node<a href> or
<img src>).
E.g.: String absUrl = linkEl.absUrl("href");
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 Node.baseUri(), and made
absolute using that.
As an alternate, you can use the Node.attr(java.lang.String) method with the abs: prefix, e.g.:
String absUrl = linkEl.attr("abs:href");
absUrl in class Nodekey - The attribute keyNode.attr(java.lang.String),
URL.URL(java.net.URL, String)public java.lang.String baseUri()
Nodeprotected void doSetBaseUri(java.lang.String baseUri)
NodedoSetBaseUri in class NodebaseUri - new URIpublic int childNodeSize()
NodechildNodeSize in class Nodeprotected java.util.List<Node> ensureChildNodes()
ensureChildNodes in class Node