Package com.openhtmltopdf.simple.extend
Class XhtmlCssOnlyNamespaceHandler
java.lang.Object
com.openhtmltopdf.simple.NoNamespaceHandler
com.openhtmltopdf.simple.extend.XhtmlCssOnlyNamespaceHandler
- All Implemented Interfaces:
NamespaceHandler
- Direct Known Subclasses:
XhtmlNamespaceHandler
Handles xhtml but only css styling is honored,
no presentational html attributes (see css 2.1 spec, 6.4.4)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private static StylesheetInfo
private static boolean
(package private) static final String
Description of the Field -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
collapseWhiteSpace
(String text) protected String
convertToLength
(String value) private Element
findFirstChild
(Element parent, String targetName) protected String
getAttribute
(Element e, String attrName) Gets the class attribute of the XhtmlNamespaceHandler objectprivate String
Get the Content-Language meta tag value from the head section of the doc or the empty string.getDefaultStylesheet
(StylesheetFactory factory) private InputStream
getDocumentTitle
(Document doc) Returns the title of the document as located in the contents of /html/head/title, or "" if none could be found.Gets the elementStyling attribute of the XhtmlNamespaceHandler objectGets the iD attribute of the XhtmlNamespaceHandler objectGets the language of an element as specified (in order of precedence) by the lang attribute on the element itself, the first ancestor with a lang attribute, the Content-Language meta tag or the empty string.Gets the linkUri attribute of the XhtmlNamespaceHandler objectgetMetaInfo
(Document doc) Gets the namespace attribute of the XhtmlNamespaceHandler objectgetStylesheets
(Document doc) Gets the stylesheetLinks attribute of the XhtmlNamespaceHandler objectprotected boolean
protected StylesheetInfo
readLinkElement
(Element link) protected StylesheetInfo
readStyleElement
(Element style) private static String
readTextContent
(Element element) Methods inherited from class com.openhtmltopdf.simple.NoNamespaceHandler
getAttributeValue, getAttributeValue, getImageSourceURI, getNonCssStyling, isFormElement, isImageElement
-
Field Details
-
_namespace
Description of the Field- See Also:
-
_defaultStylesheet
-
_defaultStylesheetError
private static boolean _defaultStylesheetError -
_contentLanguageMetaValue
-
-
Constructor Details
-
XhtmlCssOnlyNamespaceHandler
public XhtmlCssOnlyNamespaceHandler()
-
-
Method Details
-
getNamespace
Gets the namespace attribute of the XhtmlNamespaceHandler object- Specified by:
getNamespace
in interfaceNamespaceHandler
- Overrides:
getNamespace
in classNoNamespaceHandler
- Returns:
- The namespace value
-
getClass
Gets the class attribute of the XhtmlNamespaceHandler object- Specified by:
getClass
in interfaceNamespaceHandler
- Overrides:
getClass
in classNoNamespaceHandler
- Parameters:
e
- PARAM- Returns:
- The class value
-
getID
Gets the iD attribute of the XhtmlNamespaceHandler object- Specified by:
getID
in interfaceNamespaceHandler
- Overrides:
getID
in classNoNamespaceHandler
- Parameters:
e
- PARAM- Returns:
- The iD value
-
convertToLength
-
isInteger
-
getAttribute
-
readTextContent
-
collapseWhiteSpace
-
getLinkUri
Gets the linkUri attribute of the XhtmlNamespaceHandler object- Specified by:
getLinkUri
in interfaceNamespaceHandler
- Overrides:
getLinkUri
in classNoNamespaceHandler
- Parameters:
e
- PARAM- Returns:
- The linkUri value
-
getAnchorName
- Specified by:
getAnchorName
in interfaceNamespaceHandler
- Overrides:
getAnchorName
in classNoNamespaceHandler
- Parameters:
e
-
-
getElementStyling
Gets the elementStyling attribute of the XhtmlNamespaceHandler object- Specified by:
getElementStyling
in interfaceNamespaceHandler
- Overrides:
getElementStyling
in classNoNamespaceHandler
- Parameters:
e
- PARAM- Returns:
- The elementStyling value
-
getDocumentTitle
Returns the title of the document as located in the contents of /html/head/title, or "" if none could be found.- Specified by:
getDocumentTitle
in interfaceNamespaceHandler
- Overrides:
getDocumentTitle
in classNoNamespaceHandler
- Parameters:
doc
- the document to search for a title- Returns:
- The document's title, or "" if none found
-
findFirstChild
-
readStyleElement
-
readLinkElement
-
getStylesheets
Gets the stylesheetLinks attribute of the XhtmlNamespaceHandler object- Specified by:
getStylesheets
in interfaceNamespaceHandler
- Overrides:
getStylesheets
in classNoNamespaceHandler
- Parameters:
doc
- PARAM- Returns:
- The stylesheetLinks value
-
getDefaultStylesheet
- Specified by:
getDefaultStylesheet
in interfaceNamespaceHandler
- Overrides:
getDefaultStylesheet
in classNoNamespaceHandler
- Returns:
- the default CSS stylesheet for this namespace
-
getDefaultStylesheetStream
-
getMetaInfo
-
getContentLanguageMetaTag
Get the Content-Language meta tag value from the head section of the doc or the empty string. Caches value so can be called multiple times without performance issues. -
getLang
Gets the language of an element as specified (in order of precedence) by the lang attribute on the element itself, the first ancestor with a lang attribute, the Content-Language meta tag or the empty string.- Specified by:
getLang
in interfaceNamespaceHandler
- Overrides:
getLang
in classNoNamespaceHandler
- Parameters:
e
- PARAM- Returns:
- The lang value
-