private void getResourcesFromXML(Document doc, PetriNet pn) {

        NodeList resourcesList = doc.getElementsByTagName("resource");
        for (int i = 0; i < resourcesList.getLength(); i++) {
            Node nNode = resourcesList.item(i);

            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                Element eElement = (Element) nNode;
                Resource res = new Resource(eElement.getAttribute("name"));
                int x = Integer.parseInt(eElement.getAttribute("x"));
                int y = Integer.parseInt(eElement.getAttribute("y"));
                if (cobaFile) {
                    x = (x * 60) + 20;
                    y = (y * 38) + 20;
                }

                int quantity = Integer.parseInt(eElement.getAttribute("quantity"));
                if (eElement.getAttribute("width") != "") {
                    res.setWidth(Integer.parseInt(eElement.getAttribute("width")));
                } else {
                    res.setWidth(53);
                }
                if (eElement.getAttribute("height") != "") {
                    res.setHeight(Integer.parseInt(eElement.getAttribute("height")));
                } else {
                    res.setHeight(38);
                }
                res.setNote(eElement.getAttribute("note"));
                if (eElement.getAttribute("fontSize") != "") {
                    res.setFontSize(Integer.parseInt(eElement.getAttribute("fontSize")));
                } else {
                    res.setFontSize(16);
                }
                if (eElement.getAttribute("red1") != "") {
                    res.setColor(new Color(Integer.parseInt(eElement.getAttribute("red1")),
                            Integer.parseInt(eElement.getAttribute("green1")),
                            Integer.parseInt(eElement.getAttribute("blue1"))));
                } else {
                    res.setColor(new Color(10, 10, 10));
                }
                if (eElement.getAttribute("red2") != "") {
                    res.setColor2(new Color(Integer.parseInt(eElement.getAttribute("red2")),
                            Integer.parseInt(eElement.getAttribute("green2")),
                            Integer.parseInt(eElement.getAttribute("blue2"))));
                } else {
                    res.setColor2(new Color(255, 255, 255));
                }


                res.setMarking(quantity);
                res.setX(x);
                res.setY(y);
                //res.setDiagramElement(new DiagramElement(x, y));
                pn.addResource(res);
            }
        }
    }