|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.Node
org.kde.koala.Document
public class Document
The Document
interface represents the entire HTML or
XML document. Conceptually, it is the root of the document tree,
and provides the primary access to the document's data.
Since elements, text nodes, comments, processing instructions,
etc. cannot exist outside the context of a Document
, the Document
interface also contains the factory
methods needed to create these objects. The Node
objects created have a ownerDocument
attribute which
associates them with the Document
within whose
context they were created.
Constructor Summary | |
---|---|
|
Document()
|
|
Document(boolean arg1)
don't create an implementation if false use at own risk |
protected |
Document(java.lang.Class dummy)
|
|
Document(Document other)
|
|
Document(Node other)
|
Method Summary | |
---|---|
void |
abort()
Introduced in DOM Level 3 This method is from the DocumentLS interface If the document is currently being loaded as a result of the method load being invoked the loading and parsing is immediately aborted. |
void |
addStyleSheet(StyleSheet sheet)
Adds a new style sheet to the list of style sheets. |
boolean |
async()
Introduced in DOM Level 3 This method is from the DocumentLS interface Indicates whether the method DocumentLS.load() should be synchronous or asynchronous. |
java.lang.String |
completeURL(java.lang.String url)
not part of the DOM completes a given URL |
Attr |
createAttribute(java.lang.String name)
Creates an Attr of the given name. |
Attr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Introduced in DOM Level 2 Creates an attribute of the given qualified name and namespace URI. |
CDATASection |
createCDATASection(java.lang.String data)
Creates a CDATASection node whose value is the
specified string. |
Comment |
createComment(java.lang.String data)
Creates a Comment node given the specified
string. |
DocumentFragment |
createDocumentFragment()
Creates an empty DocumentFragment object. |
Element |
createElement(java.lang.String tagName)
Creates an element of the type specified. |
Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Introduced in DOM Level 2 Creates an element of the given qualified name and namespace URI. |
EntityReference |
createEntityReference(java.lang.String name)
Creates an EntityReference object. |
Event |
createEvent(java.lang.String eventType)
Introduced in DOM Level 2 This method is from the DocumentEvent interface The createEvent method is used in creating Events when it is either inconvenient or unnecessary for the user to create an Event themselves. |
NodeIterator |
createNodeIterator(Node root,
long whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
Introduced in DOM Level 2 This method is from the DocumentTraversal interface Create a new NodeIterator over the subtree rooted at the specified node. |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Creates a ProcessingInstruction node given the
specified name and data strings. |
Range |
createRange()
Introduced in DOM Level 2 This method is from the DocumentRange interface |
Text |
createTextNode(java.lang.String data)
Creates a Text node given the specified string. |
TreeWalker |
createTreeWalker(Node root,
long whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
Introduced in DOM Level 2 This method is from the DocumentTraversal interface Create a new TreeWalker over the subtree rooted at the specified node. |
AbstractView |
defaultView()
Introduced in DOM Level 2 This method is from the DocumentView interface The default AbstractView for this Document, or null if none available. |
boolean |
designMode()
not part of the official DOM Documents are read-only by default, but they can be made editable by entering "design mode". |
DocumentType |
doctype()
The Document Type Declaration (see DocumentType
) associated with this document. |
Element |
documentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. |
Element |
getElementById(java.lang.String elementId)
Moved from HTMLDocument in DOM Level 2 Returns the Element whose id is given by
elementId. |
java.util.ArrayList |
getElementsByTagName(java.lang.String tagname)
No Exceptions. |
java.util.ArrayList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Introduced in DOM Level 2 No Exceptions Returns an ArrayList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. |
CSSStyleDeclaration |
getOverrideStyle(Element elt,
java.lang.String pseudoElt)
Introduced in DOM Level 2 This method is from the DocumentCSS interface This method is used to retrieve the override style declaration for a specified element and a specified pseudo-element. |
DOMImplementation |
implementation()
The DOMImplementation object that handles this
document. |
Node |
importNode(Node importedNode,
boolean deep)
Introduced in DOM Level 2 Imports a node from another document to this document. |
boolean |
isHTMLDocument()
not part of the DOM |
void |
load(java.lang.String uri)
Introduced in DOM Level 3 This method is from the DocumentLS interface Replaces the content of the document with the result of parsing the given URI. |
void |
loadXML(java.lang.String source)
Introduced in DOM Level 3 This method is from the DocumentLS interface Replace the content of the document with the result of parsing the input string, this method is always synchronous. |
java.lang.String |
preferredStylesheetSet()
CSS3 mechanism for selecting alternate stylesheets using the DOM. |
void |
removeStyleSheet(StyleSheet sheet)
Removes a style sheet to the list of style sheets. |
java.lang.String |
selectedStylesheetSet()
|
void |
setAsync(boolean arg1)
Introduced in DOM Level 3 This method is from the DocumentLS interface see async |
void |
setDesignMode(boolean enable)
not part of the official DOM |
void |
setSelectedStylesheetSet(java.lang.String aString)
|
java.util.ArrayList |
styleSheets()
Introduced in DOM Level 2 This method is from the DocumentStyle interface A list containing all the style sheets explicitly linked into or embedded in a document. |
java.lang.String |
toString()
|
void |
updateRendering()
not part of the DOM Updates the rendered display after one or more changes to the DOM structure |
KHTMLView |
view()
|
Methods inherited from class org.kde.koala.Node |
---|
addEventListener, appendChild, applyChanges, attributes, childNodes, cloneNode, dispatchEvent, elementId, firstChild, getRect, hasAttributes, hasChildNodes, index, insertBefore, isNull, isSupported, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, normalize, op_equals, op_not_equals, ownerDocument, parentNode, prefix, previousSibling, removeChild, removeEventListener, replaceChild, setNodeValue, setPrefix |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Document(java.lang.Class dummy)
public Document()
public Document(boolean arg1)
public Document(Document other)
public Document(Node other)
Method Detail |
---|
public DocumentType doctype()
DocumentType
) associated with this document. For HTML documents as well as
XML documents without a document type declaration this returns
null
. The DOM Level 1 does not support editing
the Document Type Declaration, therefore docType
cannot be altered in any way.
public DOMImplementation implementation()
DOMImplementation
object that handles this
document. A DOM application may use objects from multiple
implementations.
public Element documentElement()
public Element createElement(java.lang.String tagName)
tagName
- The name of the element type to instantiate. For
XML, this is case-sensitive. For HTML, the tagName
parameter may be provided in any case, but it must be
mapped to the canonical uppercase form by the DOM
implementation.
Element
object.public Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
namespaceURI
- The namespace URI of the element to create.qualifiedName
- The qualified name of the element type to instantiate.
public DocumentFragment createDocumentFragment()
DocumentFragment
object.
DocumentFragment
.public Text createTextNode(java.lang.String data)
Text
node given the specified string.
data
- The data for the node.
Text
object.public Comment createComment(java.lang.String data)
Comment
node given the specified
string.
data
- The data for the node.
Comment
object.public CDATASection createCDATASection(java.lang.String data)
CDATASection
node whose value is the
specified string.
data
- The data for the CDATASection
contents.
CDATASection
object.public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
ProcessingInstruction
node given the
specified name and data strings.
target
- The target part of the processing instruction.data
- The data for the node.
NOT_SUPPORTED_ERR: Raised if this document is an HTML
document.
ProcessingInstruction
object.public Attr createAttribute(java.lang.String name)
Attr
of the given name. Note that the
Attr
instance can then be set on an Element
using the setAttribute
method.
name
- The name of the attribute.
Attr
object.public Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
namespaceURI
- The namespace URI of the attribute to create.qualifiedName
- The qualified name of the attribute to instantiate.
public EntityReference createEntityReference(java.lang.String name)
name
- The name of the entity to reference.
NOT_SUPPORTED_ERR: Raised if this document is an HTML
document.
EntityReference
object.public Element getElementById(java.lang.String elementId)
id
is given by
elementId. If no such element exists, returns null
. Behavior is not defined if more than one element has
this id
.
elementId
- The unique id
value for an
element.
public java.util.ArrayList getElementsByTagName(java.lang.String tagname)
ArrayList
of all the Element
's
with a given tag name in the order in which they
would be encountered in a preorder traversal of the
Document
tree.
tagname
- The name of the tag to match on. The special
value "*" matches all tags.
NodeList
object containing all the
matched Element
s.public java.util.ArrayList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
namespaceURI
- The namespace URI of the elements to match on. The
special value "*" matches all namespaces.localName
- The local name of the elements to match on. The special
value "*" matches all local names.
public Node importNode(Node importedNode, boolean deep)
importedNode
- The node to import.deep
- If true, recursively import the subtree under the specified
node; if false, import only the node itself, as explained above. This
has no effect on Attr, EntityReference, and Notation nodes.
public boolean isHTMLDocument()
public Range createRange()
public NodeIterator createNodeIterator(Node root, long whatToShow, NodeFilter filter, boolean entityReferenceExpansion)
root
- The node which will be iterated together with its children.
The iterator is initially positioned just before this node. The
whatToShow flags and the filter, if any, are not considered when setting
this position. The root must not be null.whatToShow
- This flag specifies which node types may appear in the
logical view of the tree presented by the iterator. See the description
of NodeFilter for the set of possible SHOW_ values. These flags can be
combined using OR.filter
- The NodeFilter to be used with this NodeIterator, or null to
indicate no filter.entityReferenceExpansion
- The value of this flag determines
whether entity reference nodes are expanded.
public TreeWalker createTreeWalker(Node root, long whatToShow, NodeFilter filter, boolean entityReferenceExpansion)
root
- The node which will serve as the root for the TreeWalker.
The whatToShow flags and the NodeFilter are not considered when setting
this value; any node type will be accepted as the root. The currentNode
of the TreeWalker is initialized to this node, whether or not it is
visible. The root functions as a stopping point for traversal methods
that look upward in the document structure, such as parentNode and
nextNode. The root must not be null.whatToShow
- This flag specifies which node types may appear in the
logical view of the tree presented by the tree-walker. See the
description of NodeFilter for the set of possible SHOW_ values. These
flags can be combined using OR.filter
- The NodeFilter to be used with this TreeWalker, or null to
indicate no filter.entityReferenceExpansion
- If this flag is false, the contents of
EntityReference nodes are not presented in the logical view.
public Event createEvent(java.lang.String eventType)
eventType
- The eventType parameter specifies the type of Event
interface to be created. If the Event interface specified is supported
by the implementation this method will return a new Event of the
interface type requested. If the Event is to be dispatched via the
dispatchEvent method the appropriate event init method must be called
after creation in order to initialize the Event's values. As an example,
a user wishing to synthesize some kind of UIEvent would call createEvent
with the parameter "UIEvents". The initUIEvent method could then be
called on the newly created UIEvent to set the specific type of UIEvent
to be dispatched and set its context information.
public AbstractView defaultView()
public java.util.ArrayList styleSheets()
public java.lang.String preferredStylesheetSet()
public java.lang.String selectedStylesheetSet()
public void setSelectedStylesheetSet(java.lang.String aString)
public void addStyleSheet(StyleSheet sheet)
DOMImplementation
.createCSSStyleSheet
This is not part of the official DOM.
sheet
- style sheetpublic void removeStyleSheet(StyleSheet sheet)
addStyleSheet
may be removed.
This is not part of the official DOM.
sheet
- style sheet to removepublic KHTMLView view()
public CSSStyleDeclaration getOverrideStyle(Element elt, java.lang.String pseudoElt)
elt
- The element whose style is to be modified. This parameter
cannot be null.pseudoElt
- The pseudo-element or null if none.
public boolean async()
public void setAsync(boolean arg1)
public void abort()
public void load(java.lang.String uri)
uri
- of type DOMString
The URI reference for the XML file to be loaded. If this is a relative
URI, the base URI used by the implementation is implementation dependent.public void loadXML(java.lang.String source)
source
- A string containing an XML document.public boolean designMode()
public void setDesignMode(boolean enable)
enable
- true
to enable design mode, false
to disable.designMode()
public java.lang.String completeURL(java.lang.String url)
public java.lang.String toString()
toString
in class java.lang.Object
public void updateRendering()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |