- All Implemented Interfaces:
CSSDocument,CSSNode,Serializable,Cloneable,Branch,Document,Node,Document,Node,DocumentStyle
- Direct Known Subclasses:
DOM4JUserAgent.AgentXHTMLDocumentFactory.AgentXHTMLDocument
Document.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSDocument
CSSDocument.ComplianceMode -
Field Summary
FieldsFields inherited from class org.dom4j.tree.AbstractDocument
encodingFields inherited from class org.dom4j.tree.AbstractBranch
DEFAULT_CONTENT_LIST_SIZEFields inherited from class org.dom4j.tree.AbstractNode
NODE_TYPE_NAMESFields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODEFields 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
ConstructorsModifierConstructorDescriptionprotectedprotectedXHTMLDocument(String name) protectedXHTMLDocument(String name, DOMElement rootElement, DOMDocumentType docType) protectedXHTMLDocument(DOMDocumentType docType) protectedXHTMLDocument(DOMElement rootElement) protectedXHTMLDocument(DOMElement rootElement, DOMDocumentType docType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddStyleSheet(InputSource cssSrc) Adds a style sheet (contained by the given InputSource) to the global style sheet defined by the document's default style sheet and all the linked and embedded styles.createElement(String name) Creates an element of the type specified.createElementNS(String namespaceURI, String qualifiedName) protected ErrorHandlerprotected StringvoidEnables a style sheet set.Gets the absolute base URI of this node.Gets the base URL of this Document.Gets the document's canvas for the current target medium.Get the compatibility mode (compatMode) attribute.Get the compliance mode of this document.Get the child node which is the document element of this document.protected XHTMLDocumentFactorygetElementById(String elementId) Gets the document-level error handler.getFeature(String feature, String version) Deprecated.Give the encoding used when the document was parsed, if known.Gets the style sheet set that was last selected.Get the referrer policy obtained through the 'Referrer-Policy' header or a meta element.Gets the title of the currently selected style sheet set.booleanDeprecated.Gets the style database currently used to apply specific styles to this document.Gets the merged style sheet that applies to this document, resulting from the merge of the document's default style sheet, the document linked or embedded style sheets, and the non-important part of the user style sheet.A list containing all the style sheets explicitly linked into or embedded in a document.Gets the list of available alternate styles.This document's current target medium name.Deprecated.booleanDeprecated.Deprecated.booleanHas any of the linked or embedded style sheets any error or warning ?booleanisAuthorizedOrigin(URL url) Determine whether the retrieval of the given URL is authorized.booleanisSafeOrigin(URL linkedURL) Is the provided URL a safe origin to load certain external resources?booleanisVisitedURI(String href) Has this URI been visited by the agent ?voidDeprecated.voidonMetaAdded(String name, String attribute) voidonMetaRemoved(String name, String attribute) openConnection(URL url) Opens a connection for the given URL.openStream(String uri) Opens an InputStream for the given URI, taking into account the Base URL if needed.voidForces the cascade to be rebuilt the next time that a computed style is obtained.voidregisterProperty(CSSPropertyDefinition definition) Registers the definition of a custom property.voidsetBaseURL(URL baseURL) Sets the Base URL of this Document.voidsetDocumentURI(String documentURI) protected voidsetReferrerPolicyHeader(String policy) voidSelects a style sheet set, disabling the other non-persistent sheet sets.voidsetStrictErrorChecking(boolean strictErrorChecking) Deprecated.voidsetTargetMedium(String medium) Set the medium that will be used to compute the styles of this document.setUserData(String key, Object data, UserDataHandler handler) Methods inherited from class org.dom4j.dom.DOMDocument
adoptNode, appendChild, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getAttributes, getChildNodes, getDoctype, getDomConfig, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getImplementation, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, importNode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, removeChild, renameNode, replaceChild, setNodeValue, setPrefix, setTextContent, setXmlStandalone, setXmlVersion, supportsMethods inherited from class org.dom4j.tree.DefaultDocument
addDocType, addNode, addNode, clearContent, clone, contentList, getDocType, getEntityResolver, getName, getRootElement, getXMLEncoding, processingInstruction, processingInstructions, processingInstructions, removeNode, removeProcessingInstruction, rootElementAdded, setContent, setDocType, setDocumentFactory, setEntityResolver, setNameMethods inherited from class org.dom4j.tree.AbstractDocument
accept, add, addComment, addElement, addElement, addElement, addProcessingInstruction, addProcessingInstruction, asXML, asXPathResult, checkAddElementAllowed, childAdded, childRemoved, getDocument, getNodeType, getPath, getStringValue, getUniquePath, normalize, remove, setRootElement, setXMLEncoding, toString, writeMethods inherited from class org.dom4j.tree.AbstractBranch
add, add, add, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, indexOf, invalidNodeTypeAddException, isReadOnly, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructionsMethods inherited from class org.dom4j.tree.AbstractNode
createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getParent, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, setText, supportsParent, valueOfMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.dom4j.Branch
add, add, add, appendContent, content, elementByID, indexOf, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructionsMethods inherited from interface io.sf.carte.doc.style.css.CSSDocument
getURLMethods inherited from interface org.w3c.dom.Document
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDomConfig, getElementsByTagName, getElementsByTagNameNS, getImplementation, importNode, renameNode, setXmlStandalone, setXmlVersionMethods inherited from interface org.dom4j.Node
createXPath, detach, getNodeTypeName, getParent, getPath, getText, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, setText, supportsParent, valueOfMethods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent
-
Field Details
-
XHTML_NAMESPACE_URI
- See Also:
-
-
Constructor Details
-
XHTMLDocument
protected XHTMLDocument() -
XHTMLDocument
-
XHTMLDocument
-
XHTMLDocument
-
XHTMLDocument
-
XHTMLDocument
-
-
Method Details
-
elementID
- Overrides:
elementIDin classAbstractBranch
-
getCompatMode
Get the compatibility mode (compatMode) attribute.- Specified by:
getCompatModein interfaceCSSDocument- Returns:
- the string "BackCompat" if document’s mode is
QUIRKS, otherwise "CSS1Compat".
-
getComplianceMode
Description copied from interface:CSSDocumentGet the compliance mode of this document.The styling in this document operate under a compliance mode. Two modes are supported:
STRICTandQUIRKS.QUIRKSandSTRICTdiffer in the matching of class and ID selectors, and the default user agent sheet is slightly different.- Specified by:
getComplianceModein interfaceCSSDocument- Returns:
- the compliance mode.
-
getOwnerDocument
Description copied from interface:CSSNode- Specified by:
getOwnerDocumentin interfaceCSSNode- Specified by:
getOwnerDocumentin interfaceNode- Overrides:
getOwnerDocumentin classDOMDocument
-
getDocumentElement
Description copied from interface:CSSDocumentGet the child node which is the document element of this document.- Specified by:
getDocumentElementin interfaceCSSDocument- Specified by:
getDocumentElementin interfaceDocument- Overrides:
getDocumentElementin classDOMDocument- Returns:
- the document element.
-
getElementById
Description copied from interface:CSSDocument- Specified by:
getElementByIdin interfaceCSSDocument- Specified by:
getElementByIdin interfaceDocument- Overrides:
getElementByIdin classDOMDocument
-
createElement
Description copied from interface:CSSDocumentCreates an element of the type specified.The presence of
IMPLIEDattributes is implementation-dependent.- Specified by:
createElementin interfaceCSSDocument- Specified by:
createElementin interfaceDocument- Overrides:
createElementin classDOMDocument- Parameters:
name- the tag name of the element to create.- Returns:
- the new
CSSElement. - Throws:
DOMException- INVALID_CHARACTER_ERR if the name is not an XML valid name.
-
createElementNS
Description copied from interface:CSSDocument- Specified by:
createElementNSin interfaceCSSDocument- Specified by:
createElementNSin interfaceDocument- Overrides:
createElementNSin classDOMDocument- Throws:
DOMException
-
setUserData
- Specified by:
setUserDatain interfaceNode- Overrides:
setUserDatain classDOMDocument
-
getInputEncoding
Give the encoding used when the document was parsed, if known.- Specified by:
getInputEncodingin interfaceDocument- Overrides:
getInputEncodingin classDOMDocument- Returns:
null.
-
getFeature
Deprecated.- Specified by:
getFeaturein interfaceNode- Overrides:
getFeaturein classDOMDocument
-
getStrictErrorChecking
Deprecated.- Specified by:
getStrictErrorCheckingin interfaceDocument- Overrides:
getStrictErrorCheckingin classDOMDocument
-
setStrictErrorChecking
Deprecated.- Specified by:
setStrictErrorCheckingin interfaceDocument- Overrides:
setStrictErrorCheckingin classDOMDocument
-
normalizeDocument
Deprecated.- Specified by:
normalizeDocumentin interfaceDocument- Overrides:
normalizeDocumentin classDOMDocument
-
getXmlEncoding
Deprecated.Now deprecated, this method gave the encoding specified at the XML declaration.- Specified by:
getXmlEncodingin interfaceDocument- Overrides:
getXmlEncodingin classDOMDocument- Returns:
null.
-
getXmlStandalone
Deprecated.Get whether this document is standalone as specified at the XML declaration.- Specified by:
getXmlStandalonein interfaceDocument- Overrides:
getXmlStandalonein classDOMDocument- Returns:
null.
-
getXmlVersion
Deprecated.Get the version for the "XML" feature.- Specified by:
getXmlVersionin interfaceDocument- Overrides:
getXmlVersionin classDOMDocument- Returns:
null.
-
registerProperty
Description copied from interface:CSSDocumentRegisters the definition of a custom property.- Specified by:
registerPropertyin interfaceCSSDocument- Parameters:
definition- the definition.- See Also:
-
getStyleSheets
A list containing all the style sheets explicitly linked into or embedded in a document. For HTML documents, this includes external style sheets, included via the HTML LINK element, and inline STYLE elements. In XML, this includes external style sheets, included via style sheet processing instructions (see [XML StyleSheet]).- Specified by:
getStyleSheetsin interfaceCSSDocument- Specified by:
getStyleSheetsin interfaceDocumentStyle
-
getStyleSheet
Gets the merged style sheet that applies to this document, resulting from the merge of the document's default style sheet, the document linked or embedded style sheets, and the non-important part of the user style sheet. Does not include overriden styles nor the 'important' part of the user-defined style sheet.The style sheet is lazily built.
- Specified by:
getStyleSheetin interfaceCSSDocument- Returns:
- the merged style sheet that applies to this document.
-
addStyleSheet
Adds a style sheet (contained by the given InputSource) to the global style sheet defined by the document's default style sheet and all the linked and embedded styles.- Parameters:
cssSrc- the document's InputSource.- Returns:
trueif the parsing reported no errors or fatal errors, false otherwise.- Throws:
DOMException- if a DOM problem is found parsing the sheet.IOException- if a problem is found reading the sheet.
-
getStyleSheetSets
Gets the list of available alternate styles.- Specified by:
getStyleSheetSetsin interfaceCSSDocument- Returns:
- the list of available alternate style titles.
-
getSelectedStyleSheetSet
Gets the title of the currently selected style sheet set.- Specified by:
getSelectedStyleSheetSetin interfaceCSSDocument- Returns:
- the title of the currently selected style sheet, the empty string if
none is selected, or
nullif there are style sheets from different style sheet sets that have their style sheet disabled flag unset.
-
setSelectedStyleSheetSet
Selects a style sheet set, disabling the other non-persistent sheet sets. If the name is the empty string, all non-persistent sheets will be disabled. Otherwise, if the name does not match any of the sets, does nothing.- Specified by:
setSelectedStyleSheetSetin interfaceCSSDocument- Parameters:
name- the case-sensitive name of the set to select.
-
getLastStyleSheetSet
Gets the style sheet set that was last selected.- Specified by:
getLastStyleSheetSetin interfaceCSSDocument- Returns:
- the last selected style sheet set, or
nullif none.
-
enableStyleSheetsForSet
Enables a style sheet set. If the name does not match any of the sets, does nothing.- Specified by:
enableStyleSheetsForSetin interfaceCSSDocument- Parameters:
name- the case-sensitive name of the set to enable.
-
getStyleDatabase
Gets the style database currently used to apply specific styles to this document.- Specified by:
getStyleDatabasein interfaceCSSDocument- Returns:
- the style database, or null if no style database has been selected.
-
getTargetMedium
This document's current target medium name.- Specified by:
getTargetMediumin interfaceCSSDocument- Returns:
- the target medium name of this document.
-
setTargetMedium
Set the medium that will be used to compute the styles of this document.- Specified by:
setTargetMediumin interfaceCSSDocument- Parameters:
medium- the name of the target medium, like 'screen' or 'print'.- Throws:
CSSMediaException- if the document is unable to target the given medium.
-
getCanvas
Gets the document's canvas for the current target medium.- Specified by:
getCanvasin interfaceCSSDocument- Returns:
- the canvas, or null if no target medium has been set, or the DeviceFactory does not support canvas for the target medium.
-
rebuildCascade
public void rebuildCascade()Description copied from interface:CSSDocumentForces the cascade to be rebuilt the next time that a computed style is obtained.This method should be called after you modify the styles in a way that is not detected by the library (like modifying a value).
- Specified by:
rebuildCascadein interfaceCSSDocument
-
getDocumentFactory
- Overrides:
getDocumentFactoryin classDOMDocument
-
createErrorHandler
-
getErrorHandler
Description copied from interface:CSSDocumentGets the document-level error handler.- Specified by:
getErrorHandlerin interfaceCSSDocument- Returns:
- the error handler.
-
hasStyleIssues
public boolean hasStyleIssues()Has any of the linked or embedded style sheets any error or warning ?- Specified by:
hasStyleIssuesin interfaceCSSDocument- Returns:
trueif any of the linked or embedded style sheets has any NSAC or rule error or warning,falseotherwise.
-
onMetaAdded
-
onMetaRemoved
-
getBaseURL
Gets the base URL of this Document.If the Document's
headelement has abasechild element, the base URI is computed using the value of the href attribute of thebaseelement. It can also be set with thesetBaseURLmethod.- Specified by:
getBaseURLin interfaceCSSDocument- Returns:
- the base URL, or null if no base URL could be found.
-
getBaseURI
Gets the absolute base URI of this node.- Specified by:
getBaseURIin interfaceNode- Overrides:
getBaseURIin classDOMDocument- Returns:
- the absolute base URI of this node, or null if an absolute URI could not be obtained.
-
setBaseURL
Sets the Base URL of this Document.- Parameters:
baseURL- the base URL.
-
isSafeOrigin
Is the provided URL a safe origin to load certain external resources?- Specified by:
isSafeOriginin interfaceCSSDocument- Parameters:
linkedURL- the URL of the external resource.- Returns:
trueif is a safe origin,falseotherwise.
-
isAuthorizedOrigin
Determine whether the retrieval of the given URL is authorized.If the URL's protocol is not
httpnorhttpsand document's base URL's scheme is neitherfilenorjar, it is denied.- Specified by:
isAuthorizedOriginin interfaceCSSDocument- Parameters:
url- the URL to check.- Returns:
trueif allowed.
-
getReferrerPolicy
Get the referrer policy obtained through the 'Referrer-Policy' header or a meta element.- Specified by:
getReferrerPolicyin interfaceCSSDocument- Returns:
- the referrer policy, or the empty string if none was specified.
-
setReferrerPolicyHeader
-
setDocumentURI
- Specified by:
setDocumentURIin interfaceDocument- Overrides:
setDocumentURIin classDOMDocument
-
getDocumentURI
- Specified by:
getDocumentURIin interfaceDocument- Overrides:
getDocumentURIin classDOMDocument
-
openConnection
Opens a connection for the given URL.- Specified by:
openConnectionin interfaceCSSDocument- Parameters:
url- the URL to open a connection to.- Returns:
- the URL connection.
- Throws:
IOException- if the connection could not be opened.
-
openStream
Opens an InputStream for the given URI, taking into account the Base URL if needed.- Parameters:
uri- the uri to open a connection.- Returns:
- the InputStream.
- Throws:
IOException- if the stream could not be opened.
-
isVisitedURI
Description copied from interface:CSSDocumentHas this URI been visited by the agent ?- Specified by:
isVisitedURIin interfaceCSSDocument- Parameters:
href- the URI.- Returns:
trueif visited,falseif not visited or the agent does not support history.
-