Code example for Element

Methods: getChildNodes, getParentNode

0
     
    /** 
     * Scan through org.w3c.dom.Element named name. 
     */ 
    void visitElement_name(org.w3c.dom.Element element) {
        String parentNode = element.getParentNode().getNodeName();
        if(element.getChildNodes().getLength() == 0)
            return; 
        if ("Document".equals(parentNode)) {
            kmlType.getDocument().setName(element.getChildNodes().item(0).getNodeValue());
        } 
        if ("Placemark".equals(parentNode)) {
            kmlType.getDocument().getLastPlacemark().setName(element.getChildNodes().item(0).getNodeValue());
        } 
    } 
 
    /** 
     * Scan through org.w3c.dom.Element named description. 
     */ 
    void visitElement_description(org.w3c.dom.Element element) {
        String parentNode = element.getParentNode().getNodeName();