private Element createElement(Document doc, String name, String textContent) {
        Element elem = doc.createElement(name);        
        if(textContent!=null)
            elem.setTextContent(textContent);
        return elem;
    }