| java.lang.Object org.zkoss.idom.util.IDOMs
Method Summary | |
public static boolean | checkVersion(Document doc, URL url) Returnss whether the loaded document's version is correct. | final public static void | dumpTree(Group group) Print a readable tree of the specified group to System.out. | final public static void | dumpTree(PrintStream s, Group group) Print a readable tree of the specified group to the specified stream. | final public static void | dumpTree(PrintWriter s, Group group) Print a readable tree of the specified group to the specified writer. | final public 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. | public static void | format(Element e) Formats the specified element for better readability by
adding white spaces. | final public static Element | getFirstElement(Group group) Returns the first child element, or null if no child element at all. | final public static String | getRequiredAttributeValue(Element e, String attrnm) Returns the required attribute value. | final public static Element | getRequiredElement(Element e, String elemnm) Returns the required element. | final public static String | getRequiredElementValue(Element e, String elemnm) Returns the required element value. | final public static Map | parseParams(Element elm, String type, String name, String value) Parses a tree of parameter elements into a map.
The tree of parameter elements is as follows.
<type>
<name>any</name>
<vaue>any</vaue>
</type>
the map after parsed (never null).
| final public static void | setContents(Collection elems, Object val) Set the contents of elements. | final public 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. | final public static String | toString(Document doc) Transforms a document to a string. |
checkVersion | public static boolean checkVersion(Document doc, URL url) throws Exception(Code) | | Returnss whether the loaded document's version is correct.
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.
Parameters: doc - the document to check Parameters: url - the URL used to show the readable message if theversion doesn't match since: 3.0.0 |
dumpTree | final public static void dumpTree(Group group)(Code) | | Print a readable tree of the specified group to System.out.
It is for debug purpose and the generated format is not XML.
To generate XML, uses
Transformer or
IDOMs.toString .
See Also: IDOMs.toString |
findElement | final public static Element findElement(List elems, String name)(Code) | | Returns the first element whose sub-element called "name" has the
same content as the name argument, or null if not found.
Parameters: elems - a list of elements to look for the specified name |
format | public static void format(Element e)(Code) | | Formats the specified element for better readability by
adding white spaces.
|
getFirstElement | final public static Element getFirstElement(Group group)(Code) | | Returns the first child element, or null if no child element at all.
|
parseParams | final public static Map parseParams(Element elm, String type, String name, String value)(Code) | | Parses a tree of parameter elements into a map.
The tree of parameter elements is as follows.
<type>
<name>any</name>
<vaue>any</vaue>
</type>
the map after parsed (never null). An empty map is returnedif no parameter is defined. The map is in the same order of the element tree.
|
setContents | final public static void setContents(Collection elems, Object val)(Code) | | Set the contents of elements.
The val argument could be an array and a collection, and each
item will be assigned to each of the list one-by-one.
Unlike
IDOMs.toContents , it handles only a collection of elements
-- all items must be elements.
Parameters: elems - the collection of elements Parameters: val - the value which could be an object, an array or a collection |
toContents | final public static Object toContents(Object obj)(Code) | | Converts elements to their contents if the giving object is
an element or an array or a collection of elements.
One item of an collection might be another collection or array.
|
|
|