private Element createNode(Node node) throws Exception {
        Element nodeElm = new Element(GPMLConstants.DataNode,
                                      GPML_NS);
        // Convert attributes
        // Integer cannot be used for xsd:ID. Adding "n" for "Node" to create a valid id
        String id = "n" + node.getID() + "";
        nodeElm.setAttribute(GPMLConstants.GraphId, id);
        nodeElm.setAttribute(GPMLConstants.TextLabel,
                             node.getDisplayName());
        String type = null;
        if (node instanceof RenderableProtein)
            type = GPMLConstants.Protein;
        else if (node instanceof RenderableRNA)
            type = GPMLConstants.Rna;
        else if (node instanceof RenderableChemical)
            type = GPMLConstants.Metabolite;
        else if (node instanceof RenderableComplex)
            type = GPMLConstants.Complex;
        else if (node instanceof ProcessNode)
            type = GPMLConstants.Pathway;
        else
            type = GPMLConstants.Unknown;
        nodeElm.setAttribute(GPMLConstants.Type,
                             type);
        addGraphicsElm(node, nodeElm);
        // Xref is required except for labels
        if (type != GPMLConstants.Label) {
            Element xrefElm = createXrefForNode(node);
            nodeElm.addContent(xrefElm);
        }
        return nodeElm;
    }