Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.xml.dom.html2
Class DomHTMLDocument  view DomHTMLDocument download DomHTMLDocument.java

java.lang.Object
  extended bygnu.xml.dom.DomNode
      extended bygnu.xml.dom.DomDocument
          extended bygnu.xml.dom.html2.DomHTMLDocument
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, org.w3c.dom.Document, org.w3c.dom.events.DocumentEvent, org.w3c.dom.traversal.DocumentTraversal, org.w3c.dom.events.EventTarget, org.w3c.dom.html2.HTMLDocument, org.w3c.dom.Node, org.w3c.dom.NodeList, org.w3c.dom.xpath.XPathEvaluator

public class DomHTMLDocument
extends gnu.xml.dom.DomDocument
implements org.w3c.dom.html2.HTMLDocument

An HTML document. This is the factory object used to create HTML elements.


Nested Class Summary
 
Nested classes inherited from class gnu.xml.dom.DomNode
 
Field Summary
private static java.util.Map ELEMENT_CLASSES
           
private static java.lang.Class[] ELEMENT_PT
           
private static java.util.Set HTML_NS_URIS
           
 
Fields inherited from class gnu.xml.dom.DomDocument
 
Fields inherited from class gnu.xml.dom.DomNode
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
DomHTMLDocument()
          Convenience constructor.
DomHTMLDocument(DomHTMLImpl impl)
          Constructor.
 
Method Summary
 void close()
          Closes a document stream opened by open() and forces rendering.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Creates an element of the type specified.
 org.w3c.dom.Element createElementNS(java.lang.String uri, java.lang.String qName)
          Creates an element of the given qualified name and namespace URI.
 org.w3c.dom.html2.HTMLCollection getAnchors()
          A collection of all the anchor (A) elements in a document with a value for the name attribute.
 org.w3c.dom.html2.HTMLCollection getApplets()
          A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.
 org.w3c.dom.html2.HTMLElement getBody()
          The element that contains the content for the document.
private  org.w3c.dom.Node getChildNodeByName(org.w3c.dom.Node parent, java.lang.String name)
           
 java.lang.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 the cookies non-terminal of [IETF RFC 2965], Section 4.2.2.
 java.lang.String getDomain()
          The domain name of the server that served the document, or null if the server cannot be identified by a domain name.
 org.w3c.dom.NodeList getElementsByName(java.lang.String name)
          With [HTML 4.01] documents, this method returns the (possibly empty) collection of elements whose name value is given by elementName.
 org.w3c.dom.html2.HTMLCollection getForms()
          A collection of all the forms of a document.
 org.w3c.dom.html2.HTMLCollection getImages()
          A collection of all the IMG elements in a document.
 org.w3c.dom.html2.HTMLCollection getLinks()
          A collection of all AREA elements and anchor ( A) elements in a document with a value for the href attribute.
 java.lang.String getReferrer()
          Returns the URI [IETF RFC 2396] of the page that linked to this page.
 java.lang.String getTitle()
          The title of a document as specified by the TITLE element in the head of the document.
 java.lang.String getURL()
          The absolute URI [IETF RFC 2396] of the document.
 void open()
          Open a document stream for writing.
 void setBody(org.w3c.dom.html2.HTMLElement body)
          The element that contains the content for the document.
 void setCookie(java.lang.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 the cookies non-terminal of [IETF RFC 2965], Section 4.2.2.
 void setTitle(java.lang.String title)
          The title of a document as specified by the TITLE element in the head of the document.
 void write(java.lang.String text)
          Write a string of text to a document stream opened by open().
 void writeln(java.lang.String text)
          Write a string of text followed by a newline character to a document stream opened by open().
 
Methods inherited from class gnu.xml.dom.DomDocument
adoptNode, appendChild, createAttribute, createAttributeNS, createCDATASection, createCDATASection, createComment, createDocumentFragment, createEntityReference, createExpression, createNodeIterator, createNSResolver, createProcessingInstruction, createTextNode, createTextNode, createTreeWalker, evaluate, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getImplementation, getInputEncoding, getNodeName, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertBefore, isDefaultNamespace, isEqualNode, lookupNamespaceURI, lookupPrefix, normalizeDocument, renameNode, replaceChild, setBuilding, setCheckingCharacters, setCheckWellformedness, setDocumentURI, setInputEncoding, setStrictErrorChecking, setXmlEncoding, setXmlStandalone, setXmlVersion, verifyXmlName
 
Methods inherited from class gnu.xml.dom.DomNode
addEventListener, clone, cloneNode, compact, compareDocumentPosition, compareTo, createEvent, dispatchEvent, getAttributes, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getFeature, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, isReadonly, isSameNode, isSupported, item, list, makeReadonly, nameAndTypeEquals, normalize, removeChild, removeEventListener, setNodeValue, setPrefix, setTextContent, setUserData, toString, trimToSize
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Document
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Field Detail

ELEMENT_PT

private static final java.lang.Class[] ELEMENT_PT

ELEMENT_CLASSES

private static java.util.Map ELEMENT_CLASSES

HTML_NS_URIS

private static java.util.Set HTML_NS_URIS
Constructor Detail

DomHTMLDocument

public DomHTMLDocument()
Convenience constructor.


DomHTMLDocument

public DomHTMLDocument(DomHTMLImpl impl)
Constructor. This is called by the DOMImplementation.

Method Detail

getChildNodeByName

private org.w3c.dom.Node getChildNodeByName(org.w3c.dom.Node parent,
                                            java.lang.String name)

getTitle

public java.lang.String getTitle()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The title of a document as specified by the TITLE element in the head of the document.

Specified by:
getTitle in interface org.w3c.dom.html2.HTMLDocument

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The title of a document as specified by the TITLE element in the head of the document.

Specified by:
setTitle in interface org.w3c.dom.html2.HTMLDocument

getReferrer

public java.lang.String getReferrer()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
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 org.w3c.dom.html2.HTMLDocument

getDomain

public java.lang.String getDomain()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The domain name of the server that served the document, or null if the server cannot be identified by a domain name.

Specified by:
getDomain in interface org.w3c.dom.html2.HTMLDocument

getURL

public java.lang.String getURL()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The absolute URI [IETF RFC 2396] of the document.

Specified by:
getURL in interface org.w3c.dom.html2.HTMLDocument

getBody

public org.w3c.dom.html2.HTMLElement getBody()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The element that contains the content for the document. In documents with BODY contents, returns the BODY element. In frameset documents, this returns the outermost FRAMESET element.

Specified by:
getBody in interface org.w3c.dom.html2.HTMLDocument

setBody

public void setBody(org.w3c.dom.html2.HTMLElement body)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
The element that contains the content for the document. In documents with BODY contents, returns the BODY element. In frameset documents, this returns the outermost FRAMESET element.

Specified by:
setBody in interface org.w3c.dom.html2.HTMLDocument

getImages

public org.w3c.dom.html2.HTMLCollection getImages()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
A collection of all the IMG elements in a document. The behavior is limited to IMG elements for backwards compatibility. As suggested by [HTML 4.01], to include images, authors may use the OBJECT element or the IMG element. Therefore, it is recommended not to use this attribute to find the images in the document but getElementsByTagName with HTML 4.01 or getElementsByTagNameNS with XHTML 1.0.

Specified by:
getImages in interface org.w3c.dom.html2.HTMLDocument

getApplets

public org.w3c.dom.html2.HTMLCollection getApplets()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.

Specified by:
getApplets in interface org.w3c.dom.html2.HTMLDocument

getLinks

public org.w3c.dom.html2.HTMLCollection getLinks()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
A collection of all AREA elements and anchor ( A) elements in a document with a value for the href attribute.

Specified by:
getLinks in interface org.w3c.dom.html2.HTMLDocument

getForms

public org.w3c.dom.html2.HTMLCollection getForms()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
A collection of all the forms of a document.

Specified by:
getForms in interface org.w3c.dom.html2.HTMLDocument

getAnchors

public org.w3c.dom.html2.HTMLCollection getAnchors()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
A collection of all the anchor (A) elements in a document with a value for the name attribute. For reasons of backward compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute. Note that in [XHTML 1.0], the name attribute (see section 4.10) has no semantics and is only present for legacy user agents: the id attribute is used instead. Users should prefer the iterator mechanisms provided by [DOM Level 2 Traversal] instead.

Specified by:
getAnchors in interface org.w3c.dom.html2.HTMLDocument

getCookie

public java.lang.String getCookie()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
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 the cookies 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 the cookie 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 org.w3c.dom.html2.HTMLDocument

setCookie

public void setCookie(java.lang.String cookie)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
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 the cookies 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 the cookie 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 org.w3c.dom.html2.HTMLDocument

open

public void open()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
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 org.w3c.dom.html2.HTMLDocument

close

public void close()
Description copied from interface: org.w3c.dom.html2.HTMLDocument
Closes a document stream opened by open() and forces rendering.

Specified by:
close in interface org.w3c.dom.html2.HTMLDocument

write

public void write(java.lang.String text)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
Write a string of text to a document stream opened by open(). 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 org.w3c.dom.html2.HTMLDocument

writeln

public void writeln(java.lang.String text)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
Write a string of text followed by a newline character to a document stream opened by open(). 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 org.w3c.dom.html2.HTMLDocument

getElementsByName

public org.w3c.dom.NodeList getElementsByName(java.lang.String name)
Description copied from interface: org.w3c.dom.html2.HTMLDocument
With [HTML 4.01] documents, this method returns the (possibly empty) collection of elements whose name value is given by elementName. 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 org.w3c.dom.html2.HTMLDocument

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
Description copied from interface: org.w3c.dom.Document
Creates an element of the type specified. Note that the instance returned implements the Element 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 the createElementNS method.

Specified by:
createElement in interface org.w3c.dom.Document

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String uri,
                                           java.lang.String qName)
Description copied from interface: org.w3c.dom.Document
Creates an element of the given qualified name and namespace URI.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Specified by:
createElementNS in interface org.w3c.dom.Document