class SrgsNodeFactory implements XmlNodeFactory<SrgsNode> {

    public SrgsNode getXmlNode(final Node node) {
        // Do nothing if the node is null
        if (node == null) {
            return null;
        }

        // Do nothing if we already have the righttype.
        if (node instanceof SrgsNode) {
            return (SrgsNode) node;
        }

        String name = node.getLocalName();
        if (name == null) {
            name = node.getNodeName();
        }
        final SrgsNode srgsXmlNode = NODES.get(name);
        if (srgsXmlNode == null) {
            LOGGER.warning("cannot resolve node with name '" + name + "'");

            return new GenericSrgsNode(node);
        }

        return (SrgsNode) srgsXmlNode.newInstance(node, this);
    }

      SrgsNodeFactory();

}