java.lang.Object
org.joox.Util
DOM utilities
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
The states in the state machine for splitting strings into lists -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Pattern
A pattern for the dd.mm.yyyy formatprivate static final Pattern
A pattern for various yyyy-mm-dd formatsprivate static boolean
A flag indicating whether xalan extensions have been loadedprivate static XPathFunctionResolver
The xalan extensionsXPathFunctionResolver
if availableprivate static NamespaceContext
The xalan extensionsNamespaceContext
if available -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static final String
Get an attribute value if it exists, ornull
(package private) static final String
Get an attribute value if it exists, ornull
(package private) static final Context
Create a context object(package private) static final Context
context
(Element match, int matchIndex, int matchSize, Element element, int elementIndex, int elementSize) Create a context object(package private) static final DocumentFragment
createContent
(Document doc, String text) Create some content in the context of a given document(package private) static final String
defaultIfEmpty
(String string, String defaultString) (package private) static final Element[]
private static final Date
getDate
(int year, int month, int day, int hour, int minute, int second, int millisecond) (package private) static final String
getNamespace
(String tagName) importOrDetach
(Document document, Element... elements) Make a list of elements available in a document.(package private) static final String
Returnstring
or""
ifstring
isnull
(package private) static final Date
Parse any date format(package private) static final String
Return an path expression describing an elementprivate static final int
siblingIndex
(Element element) Find the index among siblings of the same tag nameSplit a string into values(package private) static final String
stripNamespace
(String tagName) (package private) static final boolean
textNodesOnly
(NodeList list) Check whether there are any element nodes in aNodeList
(package private) static final String
Transform anElement
into aString
.(package private) static final void
xalanExtensionAware
(XPath xpath) Make a givenXPath
object "xalan-extension aware", if Xalan is on the classpath.(package private) static final String
Return an XPath expression describing an element
-
Field Details
-
xalanExtensionLoaded
private static volatile boolean xalanExtensionLoadedA flag indicating whether xalan extensions have been loaded -
xalanNamespaceContext
The xalan extensionsNamespaceContext
if available -
xalanFunctionResolver
The xalan extensionsXPathFunctionResolver
if available -
PATTERN_DD_MM_YYYY
A pattern for the dd.mm.yyyy format -
PATTERN_YYYY_MM_DD
A pattern for various yyyy-mm-dd formats
-
-
Constructor Details
-
Util
Util()
-
-
Method Details
-
createContent
Create some content in the context of a given document- Returns:
- A
DocumentFragment
iftext
is well-formed. null
, iftext
is plain text or not well formed
- A
-
attr
Get an attribute value if it exists, ornull
-
attr
Get an attribute value if it exists, ornull
-
importOrDetach
Make a list of elements available in a document.- Any element that is already in the document will be detached from its parent
- Any element that is not already in the document will be deep-imported
- Parameters:
document
- The document to import elements intoelements
- The elements that are made available to a document.- Returns:
- Elements that are all in the supplied document, but detached.
-
elements
-
toString
Transform anElement
into aString
. -
textNodesOnly
Check whether there are any element nodes in aNodeList
-
xpath
Return an XPath expression describing an element -
path
Return an path expression describing an element -
siblingIndex
Find the index among siblings of the same tag name -
context
Create a context object -
context
static final Context context(Element match, int matchIndex, int matchSize, Element element, int elementIndex, int elementSize) Create a context object -
nonNull
Returnstring
or""
ifstring
isnull
-
split
Split a string into values -
xalanExtensionAware
Make a givenXPath
object "xalan-extension aware", if Xalan is on the classpath. -
parseDate
Parse any date format -
getDate
private static final Date getDate(int year, int month, int day, int hour, int minute, int second, int millisecond) -
defaultIfEmpty
-
getNamespace
-
stripNamespace
-