Java Reference
In-Depth Information
Node node = nl.item(i);
String nodename = node.getNodeName();
// RSS 2.0
if (nodename.equalsIgnoreCase("channel"))
{
loadChannel(node);
}
// RSS 1.0
else if (nodename.equalsIgnoreCase("item"))
{
loadItem(node);
}
}
}
/**
* Simple utility method that obtains the text of an XML
* node.
* @param n The XML node.
* @return The text of the specified XML node.
*/
public static String getXMLText(Node n)
{
NodeList list = n.getChildNodes();
for (int i = 0; i < list.getLength(); i++)
{
Node n2 = list.item(i);
if (n2.getNodeType() == Node.TEXT_NODE)
return n2.getNodeValue();
}
return null;
}
/**
* Get the list of attributes.
* @return the attributes
*/
public Map<String, String> getAttributes()
{
return attributes;
}
/**
* Convert the object to a String.
Search WWH ::




Custom Search