]]> OMDOMReader dom2Reader = new OMDOMReader( CurrentNode ); OMObject m2Object = dom2Reader.readObject(); out.println("CurrentNode is " + m2Object.toString()); //out.println("attributes"+CurrentNode2Attribute); OMDOMReader dom3Reader = new OMDOMReader( CurrentNode.getParentNode() ); OMObject m3Object = dom3Reader.readObject(); out.println("The parent of CurrenNode is " + m3Object.toString()); Intermediary results //Node CurrentNodeParent2 = CurrentNode.getParentNode(); String CurrentNodeParentName = CurrentNodeParent.getNodeName(); String CurrentNodeName = CurrentNode.getNodeName(); out.println("CurrentNode "+CurrentNode); CurrentNodeParentName CurrentNodeName ******* cnn is out.println("current node type is "+CurrentNode.getNodeName()); out.println("current node parent is "+CurrentNode.getParentNode().getNodeName()); //Node CurrentNodeParent = CurrentNode.getParentNode(); NodeList listChildren = CurrentNodeParent.getChildNodes(); int lc=listChildren.getLength(); out.println("There are "+lc+" children"); //out.println("The children are "+listChildren.item(0)); out.println("The parent is "+CurrentNodeParent); //OMDOMReader dom4Reader = new OMDOMReader( listChildren.item(2) ); //OMObject m4Object = dom4Reader.readObject(); //out.println("The third child is " + m4Object.toString()); //out.println("The attribute of the third child is "+listChildren.item(2).getAttributes().item(0)); //OMDOMReader dom5Reader = new OMDOMReader( listChildren.item(1) ); //OMObject m5Object = dom5Reader.readObject(); //out.println("The second child is " + m5Object.toString()); //out.println("The attribute of the second child is "+listChildren.item(1).getAttributes().item(0)); int j,counter = 0, control = 0; String indicatorValue = "1"; out.println("lc "+lc); for (j=0;j<lc;j++) { Node aNode = listChildren.item(j); if (!aNode.getNodeName().equals("OMS")) { NamedNodeMap aNodeAttributes = aNode.getAttributes(); //out.println("control"+ aNodeAttributes.item(0)); if (aNodeAttributes!=null) { Node aNodeAttr=aNodeAttributes.getNamedItem("indicator"); //out.println("control2"+ aNodeAttr.getNodeValue()); if ( aNodeAttr != null ){ if( aNodeAttr.getNodeValue().equals(indicatorValue)) { counter++; //out.println("counter"); } } } control++; } } //if (counter==control) out.println(counter+" child(ren) "+" out of "+ control+" has(have) indicator "+indicatorValue); //else //out.println(" "); control counter Congratulations!! Now you can compute the derivative of the parent OMDOMReader dom12Reader = new OMDOMReader( CurrentNode ); OMObject m12Object = dom12Reader.readObject(); out.println("Final CurrentNode is " + m12Object.toString()); CurrentNodeElement.setAttribute("current","0"); int k; //String indicatorValue = "1"; out.println("lc "+lc); Node fChild2 = null; Element fChild2Element = null; for (k=0;k<lc;k++) { Node bNode = listChildren.item(k); if (!bNode.getNodeName().equals("OMS")) { NamedNodeMap bNodeAttributes = bNode.getAttributes(); //out.println("control"+ bNodeAttributes.item(0)); if (bNodeAttributes!=null) { Node attr = bNodeAttributes.getNamedItem("indicator"); //out.println("i is "+i+", attr is "+attr+"val"); if (attr != null){ if("0".equals(attr.getNodeValue())) { fChild2 = bNode; if (fChild2 instanceof Element){ fChild2Element = (Element) fChild2; } else{ fChild2Element = null; } fChild2Element.setAttribute ( "current", "1" ); break; } } } } } OMDOMReader dom8Reader = new OMDOMReader( fChild2 ); OMObject m8Object = dom8Reader.readObject(); OpenMath Native m8Object