class XmlUtilsImpl implements XmlUtils {

    @Override
    public Node getOrCreateChildNode(String tagName, Node parentNode)
    {
        try
        {
            Node childNode = (Node)xPath.evaluate("./" + tagName, parentNode, XPathConstants.NODE);
            if(childNode != null)
            {
                return childNode;
            }
            Element element = parentNode.getOwnerDocument().createElement(tagName);
            parentNode.appendChild(element);
            return element;
        }
        catch(Exception e)
        {
            return null;
        }
    }

}