Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gnu.xml.dom.DomNode
gnu.xml.dom.DomDocument
gnu.xml.dom.html2.DomHTMLDocument
Constructor Summary | |
| |
|
Method Summary | |
void |
|
Element |
|
Element |
|
HTMLCollection |
|
HTMLCollection |
|
HTMLElement |
|
String |
|
String |
|
NodeList |
|
HTMLCollection |
|
HTMLCollection |
|
HTMLCollection |
|
String |
|
String |
|
String |
|
void |
|
void |
|
void |
|
void | |
void | |
void |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public DomHTMLDocument(DomHTMLImpl impl)
Constructor. This is called by the DOMImplementation.
public void close()
Closes a document stream opened byopen()
and forces rendering.
- Specified by:
- close in interface HTMLDocument
public Element createElement(String tagName)
Creates an element of the type specified. Note that the instance returned implements theElement
interface, so attributes can be specified directly on the returned object.
In addition, if there are known attributes with default values,Attr
nodes representing them are automatically created and attached to the element.
To create an element with a qualified name and namespace URI, use thecreateElementNS
method.
- Specified by:
- createElement in interface Document
- Overrides:
- createElement in interface DomDocument
- Parameters:
tagName
- The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.
- Returns:
- A new
Element
object with thenodeName
attribute set totagName
, andlocalName
,prefix
, andnamespaceURI
set tonull
.
- Throws:
DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersion
attribute.
public Element createElementNS(String uri, String qName)
Creates an element of the given qualified name and namespace URI.
Per [XML Namespaces] , applications must use the valuenull
as the namespaceURI parameter for methods if they wish to have no namespace.
- Specified by:
- createElementNS in interface Document
- Overrides:
- createElementNS in interface DomDocument
- Parameters:
- Returns:
- A new
Element
object with the following attributes:
Attribute Value Node.nodeName
qualifiedName
Node.namespaceURI
namespaceURI
Node.prefix
prefix, extracted from qualifiedName
, ornull
if there is no prefixNode.localName
local name, extracted from qualifiedName
Element.tagName
qualifiedName
- Throws:
DOMException
- INVALID_CHARACTER_ERR: Raised if the specifiedqualifiedName
is not an XML name according to the XML version in use specified in theDocument.xmlVersion
attribute.
NAMESPACE_ERR: Raised if thequalifiedName
is a malformed qualified name, if thequalifiedName
has a prefix and thenamespaceURI
isnull
, or if thequalifiedName
has a prefix that is "xml" and thenamespaceURI
is different from " http://www.w3.org/XML/1998/namespace" [XML Namespaces] , or if thequalifiedName
or its prefix is "xmlns" and thenamespaceURI
is different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURI
is "http://www.w3.org/2000/xmlns/" and neither thequalifiedName
nor its prefix is "xmlns".
NOT_SUPPORTED_ERR: Always thrown if the current document does not support the"XML"
feature, since namespaces were defined by XML.
- Since:
- DOM Level 2
public HTMLCollection getAnchors()
A collection of all the anchor (A
) elements in a document with a value for thename
attribute. For reasons of backward compatibility, the returned set of anchors only contains those anchors created with thename
attribute, not those created with theid
attribute. Note that in [XHTML 1.0], thename
attribute (see section 4.10) has no semantics and is only present for legacy user agents: theid
attribute is used instead. Users should prefer the iterator mechanisms provided by [DOM Level 2 Traversal] instead.
- Specified by:
- getAnchors in interface HTMLDocument
public HTMLCollection getApplets()
A collection of all theOBJECT
elements that include applets andAPPLET
(deprecated) elements in a document.
- Specified by:
- getApplets in interface HTMLDocument
public HTMLElement getBody()
The element that contains the content for the document. In documents withBODY
contents, returns theBODY
element. In frameset documents, this returns the outermostFRAMESET
element.
- Specified by:
- getBody in interface HTMLDocument
public String getCookie()
This mutable string attribute denotes persistent state information that (1) is associated with the current frame or document and (2) is composed of information described by thecookies
non-terminal of [IETF RFC 2965], Section 4.2.2.
If no persistent state information is available for the current frame or document document, then this property's value is an empty string.
When this attribute is read, all cookies are returned as a single string, with each cookie's name-value pair concatenated into a list of name-value pairs, each list item being separated by a ';' (semicolon).
When this attribute is set, the value it is set to should be a string that adheres to thecookie
non-terminal of [IETF RFC 2965]; that is, it should be a single name-value pair followed by zero or more cookie attribute values. If no domain attribute is specified, then the domain attribute for the new value defaults to the host portion of an absolute URI [IETF RFC 2396] of the current frame or document. If no path attribute is specified, then the path attribute for the new value defaults to the absolute path portion of the URI [IETF RFC 2396] of the current frame or document. If no max-age attribute is specified, then the max-age attribute for the new value defaults to a user agent defined value. If a cookie with the specified name is already associated with the current frame or document, then the new value as well as the new attributes replace the old value and attributes. If a max-age attribute of 0 is specified for the new value, then any existing cookies of the specified name are removed from the cookie storage. See [IETF RFC 2965] for the semantics of persistent state item attribute value pairs. The precise nature of a user agent session is not defined by this specification.
- Specified by:
- getCookie in interface HTMLDocument
public String getDomain()
The domain name of the server that served the document, ornull
if the server cannot be identified by a domain name.
- Specified by:
- getDomain in interface HTMLDocument
public NodeList getElementsByName(String name)
With [HTML 4.01] documents, this method returns the (possibly empty) collection of elements whosename
value is given byelementName
. In [XHTML 1.0] documents, this methods only return the (possibly empty) collection of form controls with matching name. This method is case sensitive.
- Specified by:
- getElementsByName in interface HTMLDocument
- Parameters:
- Returns:
- The matching elements.
public HTMLCollection getForms()
A collection of all the forms of a document.
- Specified by:
- getForms in interface HTMLDocument
public HTMLCollection getImages()
A collection of all theIMG
elements in a document. The behavior is limited toIMG
elements for backwards compatibility. As suggested by [HTML 4.01], to include images, authors may use theOBJECT
element or theIMG
element. Therefore, it is recommended not to use this attribute to find the images in the document butgetElementsByTagName
with HTML 4.01 orgetElementsByTagNameNS
with XHTML 1.0.
- Specified by:
- getImages in interface HTMLDocument
public HTMLCollection getLinks()
A collection of allAREA
elements and anchor (A
) elements in a document with a value for thehref
attribute.
- Specified by:
- getLinks in interface HTMLDocument
public String getReferrer()
Returns the URI [IETF RFC 2396] of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).
- Specified by:
- getReferrer in interface HTMLDocument
public String getTitle()
The title of a document as specified by theTITLE
element in the head of the document.
- Specified by:
- getTitle in interface HTMLDocument
public String getURL()
The absolute URI [IETF RFC 2396] of the document.
- Specified by:
- getURL in interface HTMLDocument
public void open()
Open a document stream for writing. If a document exists in the target, this method clears it. This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered (see [DOM Level 3 Load and Save]).
- Specified by:
- open in interface HTMLDocument
public void setBody(HTMLElement body)
The element that contains the content for the document. In documents withBODY
contents, returns theBODY
element. In frameset documents, this returns the outermostFRAMESET
element.
- Specified by:
- setBody in interface HTMLDocument
public void setCookie(String cookie)
This mutable string attribute denotes persistent state information that (1) is associated with the current frame or document and (2) is composed of information described by thecookies
non-terminal of [IETF RFC 2965], Section 4.2.2.
If no persistent state information is available for the current frame or document document, then this property's value is an empty string.
When this attribute is read, all cookies are returned as a single string, with each cookie's name-value pair concatenated into a list of name-value pairs, each list item being separated by a ';' (semicolon).
When this attribute is set, the value it is set to should be a string that adheres to thecookie
non-terminal of [IETF RFC 2965]; that is, it should be a single name-value pair followed by zero or more cookie attribute values. If no domain attribute is specified, then the domain attribute for the new value defaults to the host portion of an absolute URI [IETF RFC 2396] of the current frame or document. If no path attribute is specified, then the path attribute for the new value defaults to the absolute path portion of the URI [IETF RFC 2396] of the current frame or document. If no max-age attribute is specified, then the max-age attribute for the new value defaults to a user agent defined value. If a cookie with the specified name is already associated with the current frame or document, then the new value as well as the new attributes replace the old value and attributes. If a max-age attribute of 0 is specified for the new value, then any existing cookies of the specified name are removed from the cookie storage. See [IETF RFC 2965] for the semantics of persistent state item attribute value pairs. The precise nature of a user agent session is not defined by this specification.
- Specified by:
- setCookie in interface HTMLDocument
- Throws:
DOMException
- SYNTAX_ERR: If the new value does not adhere to the cookie syntax specified by [IETF RFC 2965].
public void setTitle(String title)
The title of a document as specified by theTITLE
element in the head of the document.
- Specified by:
- setTitle in interface HTMLDocument
public void write(String text)
Write a string of text to a document stream opened byopen()
. Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document.
- Specified by:
- write in interface HTMLDocument
- Parameters:
text
- The string to be parsed into some structure in the document structure model.
public void writeln(String text)
Write a string of text followed by a newline character to a document stream opened byopen()
. Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document
- Specified by:
- writeln in interface HTMLDocument
- Parameters:
text
- The string to be parsed into some structure in the document structure model.