/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucp.parser;

import ucp.model.*;

/**
 *
 * Class provides methods for scanning Document (uml 2.1 xmi 2.1 source model) and creating UCP model 
 * 
 * @author Trifolium Alpestre
 */
public class UcUML21XMI21Scanner {
    /**
     * org.w3c.dom.Document document
     */
    org.w3c.dom.Document document;
    private UcpModel model;

    /**
     * Create new UcUML21XMI21Scanner with org.w3c.dom.Document.
     * @param document 
     */
    public UcUML21XMI21Scanner(org.w3c.dom.Document document) {
        this.document = document;
    }
    
    /**
     * 
     * @return
     */
    public UcpModel createUcpModel() {
        visitDocument();    
        
        return model;
    }

    /**
     * Scan through org.w3c.dom.Document document.
     */
    void visitDocument() {
        org.w3c.dom.Element element = document.getDocumentElement();
        if ((element != null) && element.getTagName().equals("xmi:XMI")) {
            visitElement_xmi_XMI(element);
        }
        
    }

    /**
     * Scan through org.w3c.dom.Element named xmi:XMI.
     */
    void visitElement_xmi_XMI(org.w3c.dom.Element element) {
        // <xmi:XMI>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("xmlns:uml")) {
            }
            if (attr.getName().equals("xmi:version")) {
            }
            if (attr.getName().equals("xmlns:xmi")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("xmi:Documentation")) {
                        visitElement_xmi_Documentation(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("uml:Model")) {
                        visitElement_uml_Model(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("xmi:Extension")) {
                        visitElement_xmi_Extension(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named xmi:Documentation.
     */
    void visitElement_xmi_Documentation(org.w3c.dom.Element element) {
        // <xmi:Documentation>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("exporterVersion")) {
            }
            if (attr.getName().equals("exporter")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named uml:Model.
     */
    void visitElement_uml_Model(org.w3c.dom.Element element) {
        // <uml:Model>
// element.getValue();
        
        model = new UcpModel(); //vytvoreni modelu, podminkou je jen jeden model v xml
        
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("visibility")) {
            }
            if (attr.getName().equals("name")) {
                model.setName(attr.getValue()); //nastaveni jmena modelu
            }
            if (attr.getName().equals("xmi:type")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("packagedElement")) {
                        visitElement_packagedFirstElement(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    
    /**
     * Scan through org.w3c.dom.Element named packagedElement.
     */
    void visitElement_packagedFirstElement(org.w3c.dom.Element element) {
        // <packagedElement>
// element.getValue();
        
        UcpPackage ucpPackage = new UcpPackage();// vytvoreni baliku, first element je pouze typu balik, lze tedy vytvorit pred zjistenim typu z elementu
        
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("visibility")) {
            }
            if (attr.getName().equals("name")) {
                ucpPackage.setName(attr.getValue());//pojmenovat balik
            }
            if (attr.getName().equals("xmi:type")) {
            }
            if (attr.getName().equals("xmi:id")) {
                ucpPackage.setId(attr.getValue());//nastavit ID baliku
            }
        }
        
        model.addPackage(ucpPackage);//vlozeni baliku do modelu
        
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("packagedElement")) {//package ma pouze elementy packagedElement
                        visitElement_packagedElement(nodeElement, ucpPackage);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }
    
    
    /**
     * Scan through org.w3c.dom.Element named packagedElement.
     */
    void visitElement_packagedElement(org.w3c.dom.Element element, UcpPackage ucpParentPackage) {
        // <packagedElement>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        
        String name = null;
        String id = null;
        String type = null;
        
        UcpPackage ucpPackage = null;
        UcpUseCase ucpUseCase = null;
        UcpActor ucpActor = null;
        
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("visibility")) {
            }
            if (attr.getName().equals("name")) {
                name = new String(attr.getValue());//ziskam jmeno elementu
            }
            if (attr.getName().equals("xmi:type")) {
                type = new String(attr.getValue());//ziskam typ elementu
            }
            if (attr.getName().equals("xmi:id")) {
                id = new String(attr.getValue());//ziskam id elementu
            }
        }
        
        if (type.equals("uml:Package"))
        {  //vytvoreni a naplneni noveho baliku
           ucpPackage = new UcpPackage();
           ucpPackage.setId(id);
           ucpPackage.setName(name);
           
           ucpParentPackage.addPackage(ucpPackage);
        }
        
        if (type.equals("uml:UseCase"))
        {  //vytvoreni a naplneni noveho useCase
           ucpUseCase = new UcpUseCase();
           ucpUseCase.setId(id);
           ucpUseCase.setName(name);
           
           ucpParentPackage.addUseCase(ucpUseCase);
        }

        if (type.equals("uml:Actor"))
        {  //vytvoreni a naplneni noveho Actora
           ucpActor = new UcpActor();
           ucpActor.setId(id);
           ucpActor.setName(name);
           
           ucpParentPackage.addActor(ucpActor);
        }
        
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("packagedElement")) {//pouze package (a model) ma elementy packageElement
                        visitElement_packagedElement(nodeElement, ucpPackage);
                    }
                    if (nodeElement.getTagName().equals("ownedUseCase")) {//pouze usecase ma elementy ownedUseCase
                        visitElement_ownedUseCase(nodeElement, ucpUseCase);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named ownedUseCase.
     */
    void visitElement_ownedUseCase(org.w3c.dom.Element element, UcpUseCase ucpParentUseCase) {
        // <ownedUseCase>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        
        
        UcpUseCase ucpUseCase = new UcpUseCase(); //vytvoreni a naplneni noveho useCase
        
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("visibility")) {
            }
            if (attr.getName().equals("name")) {
                ucpUseCase.setName(attr.getValue());//nastavit jmeno
            }
            if (attr.getName().equals("xmi:type")) {
            }
            if (attr.getName().equals("xmi:id")) {
                ucpUseCase.setId(attr.getValue());//nastavit ID
            }
        }
        
        ucpParentUseCase.addUseCase(ucpUseCase);//vlozeni useCase do parentUseCase
        
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("ownedUseCase")) {
                        visitElement_ownedUseCase(nodeElement, ucpUseCase);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

  
    
    
    /**
     * Scan through org.w3c.dom.Element named xmi:Extension.
     */
    void visitElement_xmi_Extension(org.w3c.dom.Element element) {
        // <xmi:Extension>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("extenderID")) {
            }
            if (attr.getName().equals("extender")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("elements")) {
                        visitElement_elements(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("connectors")) {
                        visitElement_connectors(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("diagrams")) {
                        visitElement_diagrams(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named elements.
     */
    void visitElement_elements(org.w3c.dom.Element element) {
        // <elements>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("element")) {
                        visitElement_element(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named element.
     */
    void visitElement_element(org.w3c.dom.Element element) {
        // <element>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        String idref = "";//id elementu
        
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("style")) {
            }
            if (attr.getName().equals("seqno")) {
            }
            if (attr.getName().equals("subject")) {
            }
            if (attr.getName().equals("geometry")) {
            }
            if (attr.getName().equals("scope")) {
            }
            if (attr.getName().equals("name")) {
            }
            if (attr.getName().equals("xmi:type")) {
            }
            if (attr.getName().equals("xmi:idref")) {
                
                idref = attr.getValue(); //nacteni id elementu do pomocne promenne
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("model")) {
                        visitElement_model(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("properties")) {
                        visitElement_properties(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("project")) {
                        visitElement_project(nodeElement, idref);//idref = predani id elementu dale
                    }
                    if (nodeElement.getTagName().equals("code")) {
                        visitElement_code(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("style")) {
                        visitElement_style(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("modelDocument")) {
                        visitElement_modelDocument(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("tags")) {
                        visitElement_tags(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("xrefs")) {
                        visitElement_xrefs(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("extendedProperties")) {
                        visitElement_extendedProperties(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("packageproperties")) {
                        visitElement_packageproperties(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("paths")) {
                        visitElement_paths(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("times")) {
                        visitElement_times(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("flags")) {
                        visitElement_flags(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("EAModel.scenario")) {
                        visitElement_EAModel_scenario(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named model.
     */
    void visitElement_model(org.w3c.dom.Element element) {
        // <model>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
                
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("parent")) {
            }
            if (attr.getName().equals("localID")) {
            }
            if (attr.getName().equals("owner")) {
            }
            if (attr.getName().equals("ea_eleType")) {
            }
            if (attr.getName().equals("ea_localid")) {
            }
            if (attr.getName().equals("tpos")) {
            }
            if (attr.getName().equals("package")) {
            }
            if (attr.getName().equals("package2")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named properties.
     */
    void visitElement_properties(org.w3c.dom.Element element) {
        // <properties>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("type")) {
            }
            if (attr.getName().equals("name")) {
            }
            if (attr.getName().equals("isAbstract")) {
            }
            if (attr.getName().equals("isLeaf")) {
            }
            if (attr.getName().equals("isRoot")) {
            }
            if (attr.getName().equals("documentation")) {
            }
            if (attr.getName().equals("scope")) {
            }
            if (attr.getName().equals("nType")) {
            }
            if (attr.getName().equals("sType")) {
            }
            if (attr.getName().equals("isSpecification")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named project.
     */
    void visitElement_project(org.w3c.dom.Element element, String idref) {
        // <project>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("status")) {
            }
            if (attr.getName().equals("complexity")) {
                //id elementu a integerova hodnota complexity se preda modelu,
                //ktery podle id najde element a preda mu complexity
                model.setComplexity(idref, Integer.valueOf(attr.getValue()));   
            }
            if (attr.getName().equals("modified")) {
            }
            if (attr.getName().equals("created")) {
            }
            if (attr.getName().equals("phase")) {
            }
            if (attr.getName().equals("version")) {
            }
            if (attr.getName().equals("author")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

   /**
     * Scan through org.w3c.dom.Element named project.
     */
    void visitElement_project(org.w3c.dom.Element element) {
        // <project>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("status")) {
            }
            if (attr.getName().equals("complexity")) {
            }
            if (attr.getName().equals("modified")) {
            }
            if (attr.getName().equals("created")) {
            }
            if (attr.getName().equals("phase")) {
            }
            if (attr.getName().equals("version")) {
            }
            if (attr.getName().equals("author")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }
    
    
    /**
     * Scan through org.w3c.dom.Element named code.
     */
    void visitElement_code(org.w3c.dom.Element element) {
        // <code>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("gentype")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named style.
     */
    void visitElement_style(org.w3c.dom.Element element) {
        // <style>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("appearance")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named modelDocument.
     */
    void visitElement_modelDocument(org.w3c.dom.Element element) {
        // <modelDocument>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named tags.
     */
    void visitElement_tags(org.w3c.dom.Element element) {
        // <tags>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named xrefs.
     */
    void visitElement_xrefs(org.w3c.dom.Element element) {
        // <xrefs>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("value")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named extendedProperties.
     */
    void visitElement_extendedProperties(org.w3c.dom.Element element) {
        // <extendedProperties>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("diagram")) {
            }
            if (attr.getName().equals("package_name")) {
            }
            if (attr.getName().equals("tagged")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named packageproperties.
     */
    void visitElement_packageproperties(org.w3c.dom.Element element) {
        // <packageproperties>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("tpos")) {
            }
            if (attr.getName().equals("version")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named paths.
     */
    void visitElement_paths(org.w3c.dom.Element element) {
        // <paths>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named times.
     */
    void visitElement_times(org.w3c.dom.Element element) {
        // <times>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("modified")) {
            }
            if (attr.getName().equals("created")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named flags.
     */
    void visitElement_flags(org.w3c.dom.Element element) {
        // <flags>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("packageFlags")) {
            }
            if (attr.getName().equals("logxml")) {
            }
            if (attr.getName().equals("usedtd")) {
            }
            if (attr.getName().equals("isprotected")) {
            }
            if (attr.getName().equals("iscontrolled")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named EAModel.scenario.
     */
    void visitElement_EAModel_scenario(org.w3c.dom.Element element) {
        // <EAModel.scenario>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("EAScenario")) {
                        visitElement_EAScenario(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named EAScenario.
     */
    void visitElement_EAScenario(org.w3c.dom.Element element) {
        // <EAScenario>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("subject")) {
            }
            if (attr.getName().equals("description")) {
            }
            if (attr.getName().equals("weight")) {
            }
            if (attr.getName().equals("type")) {
            }
            if (attr.getName().equals("name")) {
            }
            if (attr.getName().equals("xmi:id")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named connectors.
     */
    void visitElement_connectors(org.w3c.dom.Element element) {
        // <connectors>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named diagrams.
     */
    void visitElement_diagrams(org.w3c.dom.Element element) {
        // <diagrams>
// element.getValue();
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("diagram")) {
                        visitElement_diagram(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named diagram.
     */
    void visitElement_diagram(org.w3c.dom.Element element) {
        // <diagram>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("xmi:id")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    if (nodeElement.getTagName().equals("elements")) {
                        visitElement_elements(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("model")) {
                        visitElement_model(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("properties")) {
                        visitElement_properties(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("project")) {
                        visitElement_project(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("style1")) {
                        visitElement_style1(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("style2")) {
                        visitElement_style2(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("swimlanes")) {
                        visitElement_swimlanes(nodeElement);
                    }
                    if (nodeElement.getTagName().equals("matrixitems")) {
                        visitElement_matrixitems(nodeElement);
                    }
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named style1.
     */
    void visitElement_style1(org.w3c.dom.Element element) {
        // <style1>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("value")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named style2.
     */
    void visitElement_style2(org.w3c.dom.Element element) {
        // <style2>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("value")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named swimlanes.
     */
    void visitElement_swimlanes(org.w3c.dom.Element element) {
        // <swimlanes>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("value")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

    /**
     * Scan through org.w3c.dom.Element named matrixitems.
     */
    void visitElement_matrixitems(org.w3c.dom.Element element) {
        // <matrixitems>
// element.getValue();
        org.w3c.dom.NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);
            if (attr.getName().equals("value")) {
            }
        }
        org.w3c.dom.NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            org.w3c.dom.Node node = nodes.item(i);
            switch (node.getNodeType()) {
                case org.w3c.dom.Node.CDATA_SECTION_NODE:
                    break;
                case org.w3c.dom.Node.ELEMENT_NODE:
                    org.w3c.dom.Element nodeElement = (org.w3c.dom.Element) node;
                    break;
                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
                    break;
            }
        }
    }

}
