// parse
////////////////////////////////////////////////
public Node parse(InputStream inStream) throws ParserException
{
Node rootNode = null;
Node currNode = null;
try {
InputStreamReader inReader = new InputStreamReader(inStream);
KXmlParser xpp = new KXmlParser();
xpp.setInput(inReader);
int eventType = xpp.getEventType();
while (eventType != org.xmlpull.v1.XmlPullParser.END_DOCUMENT) {
switch (eventType) {
case org.xmlpull.v1.XmlPullParser.START_TAG:
{
Node node = new Node();
String nodeName = xpp.getName();
node.setName(nodeName);
int attrsLen = xpp.getAttributeCount();
for (int n=0; n<attrsLen; n++) {
String attrName = xpp.getAttributeName(n);
String attrValue = xpp.getAttributeValue(n);
node.setAttribute(attrName, attrValue);
}
if (currNode != null)
currNode.addNode(node);
currNode = node;