Java Reference
In-Depth Information
public class AjaxXML
{
// the size of a buffer
public static int BUFFER_SIZE = 8192;
/**
* Obtains a XML node. Specify a name such as "state.name"
* to nest several layers of nodes.
* @param e The parent node.
* @param name The child node to search for. Specify levels
* with .'s.
* @return Returns the node found.
*/
private Node getXMLNode(Node e,String name)
{
StringTokenizer tok = new StringTokenizer(name,".");
Node node = e;
while( tok.hasMoreTokens() )
{
String currentName = tok.nextToken();
NodeList list = node.getChildNodes();
int len = list.getLength();
for(int i=0;i<len;i++)
{
Node n = list.item(i);
if( n.getNodeName().equals(currentName) )
{
node = n;
break;
}
}
}
return node;
}
/**
* Obtain the specified XML attribute from the specified node.
* @param e The XML node to obtain an attribute from.
* @param name The name of the attribute.
* @return Returns the value of the attribute.
*/
private String getXMLAttribute(Node e,String name)
{
Search WWH ::




Custom Search