| Constructor and Description |
|---|
IDOMs() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkVersion(Document doc,
URL url)
Returns whether the loaded document's version is correct.
|
static void |
dumpTree(Group group)
Print a readable tree of the specified group to System.out.
|
static void |
dumpTree(PrintStream s,
Group group)
Print a readable tree of the specified group to the specified stream.
|
static void |
dumpTree(PrintWriter s,
Group group)
Print a readable tree of the specified group to the specified writer.
|
static Element |
findElement(List elems,
String name)
Returns the first element whose sub-element called "name" has the
same content as the name argument, or null if not found.
|
static void |
format(Element e)
Formats the specified element for better readability by
adding white spaces.
|
static Element |
getFirstElement(Group group)
Returns the first child element, or null if no child element at all.
|
static String |
getRequiredAttributeValue(Element e,
String attrnm)
Returns the required attribute value.
|
static Element |
getRequiredElement(Element e,
String elemnm)
Returns the required element.
|
static String |
getRequiredElementValue(Element e,
String elemnm)
Returns the required element value.
|
static Map<String,String> |
parseParams(Element elm,
String type,
String name,
String value)
Parses a tree of parameter elements into a map.
|
static void |
setContents(Collection<Element> elems,
Object val)
Set the contents of elements.
|
static Object |
toContents(Object obj)
Converts elements to their contents if the giving object is
an element or an array or a collection of elements.
|
static String |
toString(Document doc)
Transforms a document to a string.
|
public static final Element getRequiredElement(Element e, String elemnm) throws IllegalSyntaxException
elemnm - the element nameIllegalSyntaxExceptionpublic static final String getRequiredElementValue(Element e, String elemnm) throws IllegalSyntaxException
Note: the returned value may be an empty string (if the element contains no text at all).
IllegalSyntaxException - if the element is not foundpublic static final String getRequiredAttributeValue(Element e, String attrnm) throws IllegalSyntaxException
IllegalSyntaxException - if the element is not foundpublic static final Element getFirstElement(Group group)
public static final Element findElement(List elems, String name)
elems - a list of elements to look for the specified namepublic static final Map<String,String> parseParams(Element elm, String type, String name, String value)
The tree of parameter elements is as follows.
<type>
<name>any</name>
<vaue>any</vaue>
</type>public static void format(Element e)
public static final Object toContents(Object obj)
public static final void setContents(Collection<Element> elems, Object val)
Unlike toContents(java.lang.Object), it handles only a collection of elements
-- all items must be elements.
elems - the collection of elementsval - the value which could be an object, an array or a collectionpublic static final String toString(Document doc) throws TransformerConfigurationException, TransformerException
public static final void dumpTree(Group group)
Transformer or toString(org.zkoss.idom.Document).toString(org.zkoss.idom.Document)public static final void dumpTree(PrintStream s, Group group)
Transformer or toString(org.zkoss.idom.Document).toString(org.zkoss.idom.Document)public static final void dumpTree(PrintWriter s, Group group)
Transformer or toString(org.zkoss.idom.Document).toString(org.zkoss.idom.Document)public static boolean checkVersion(Document doc, URL url) throws Exception
It assumes the version info is specified in the document in the following format:
<version>
<version-class>org.zkoss.zul.Version</version-class>
<version-uid>3.0.0</version-uid>
</version>
Note: it returns true if the version info is not found.
doc - the document to checkurl - the URL used to show the readable message if the
version doesn't matchExceptionCopyright © 2018. All rights reserved.