|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.txml.XMLUtil
Set of useful utility functions
| Constructor Summary | |
XMLUtil()
|
|
| Method Summary | |
static java.lang.String[] |
selectAllValues(XMLNode tree,
java.lang.String select)
Utility function to select all values from the XML tree (an array of values is returned). |
static java.lang.String |
selectOneValue(XMLNode tree,
java.lang.String select)
Utility function to select one value from the XML tree. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XMLUtil()
| Method Detail |
public static java.lang.String selectOneValue(XMLNode tree,
java.lang.String select)
Utility function to select one value from the XML tree. If search returns zero nodes, null is returned. If search returns multiple nodes, the value of the first one will be returned. If first selected node does not have a value, return is null.
Useful for retrieving one particular node value. Example:
<title>
<font>
Lucida-bold
</font>
<color>
Green
</color>
<icon>
icons/icon-image.bmp
</icon>
</title>
Following code:
... XMLNode tree = ... // create or obtain xml tree String value = XMLUtil.selectOneValue(tree, "/title/color");will return string "Green".
public static java.lang.String[] selectAllValues(XMLNode tree,
java.lang.String select)
Utility function to select all values from the XML tree (an array of values is returned). Array elements may be null (if corresponding selected node does not have any value.
Usefult for retrieving arrays of data. Example:
<animated-button>
<image>
images/button1.gif
</image>
<image>
images/button2.gif
</image>
<image>
images/button3.gif
</image>
</animated-button>
Following code:
... XMLNode tree = ... // create or obtain xml tree String [] value = XMLUtil.selectAllValues(tree, "/animated-button/image");will return string array
{
"images/button1.gif",
"images/button2.gif",
"images/button3.gif"
};
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||