Example usage for org.jdom2 Element getChild

List of usage examples for org.jdom2 Element getChild

Introduction

In this page you can find the example usage for org.jdom2 Element getChild.

Prototype

public Element getChild(final String cname, final Namespace ns) 

Source Link

Document

This returns the first child element within this element with the given local name and belonging to the given namespace.

Usage

From source file:ch.kostceco.tools.kostval.validation.modulesiard.impl.ValidationHcontentModuleImpl.java

License:Open Source License

@Override
public boolean validate(File valDatei, File directoryOfLogfile) throws ValidationHcontentException {
    // Ausgabe SIARD-Modul Ersichtlich das KOST-Val arbeitet
    System.out.print("H   ");
    System.out.print("\r");
    int onWork = 41;

    boolean valid = true;
    try {//w  w  w  .  j a  v  a2  s .c  om
        /* Extract the metadata.xml from the temporary work folder and build a jdom document */
        String pathToWorkDir = getConfigurationService().getPathToWorkDir();
        pathToWorkDir = pathToWorkDir + File.separator + "SIARD";
        File metadataXml = new File(new StringBuilder(pathToWorkDir).append(File.separator).append("header")
                .append(File.separator).append("metadata.xml").toString());
        InputStream fin = new FileInputStream(metadataXml);
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(fin);
        fin.close();

        /* read the document and for each schema and table entry verify existence in temporary
         * extracted structure */
        Namespace ns = Namespace.getNamespace("http://www.bar.admin.ch/xmlns/siard/1.0/metadata.xsd");
        // select schema elements and loop
        List<Element> schemas = document.getRootElement().getChild("schemas", ns).getChildren("schema", ns);
        for (Element schema : schemas) {
            Element schemaFolder = schema.getChild("folder", ns);
            File schemaPath = new File(new StringBuilder(pathToWorkDir).append(File.separator).append("content")
                    .append(File.separator).append(schemaFolder.getText()).toString());
            if (schemaPath.isDirectory()) {
                Element[] tables = schema.getChild("tables", ns).getChildren("table", ns)
                        .toArray(new Element[0]);
                for (Element table : tables) {
                    Element tableFolder = table.getChild("folder", ns);
                    File tablePath = new File(new StringBuilder(schemaPath.getAbsolutePath())
                            .append(File.separator).append(tableFolder.getText()).toString());
                    if (tablePath.isDirectory()) {
                        File tableXml = new File(new StringBuilder(tablePath.getAbsolutePath())
                                .append(File.separator).append(tableFolder.getText() + ".xml").toString());
                        File tableXsd = new File(new StringBuilder(tablePath.getAbsolutePath())
                                .append(File.separator).append(tableFolder.getText() + ".xsd").toString());
                        // TODO: hier erfolgt die Validerung
                        if (verifyRowCount(tableXml, tableXsd)) {

                            // valid = validate1( tableXml, tableXsd ) && valid;

                            // xmllint via cmd
                            // resources\xmllint\xmllint --noout --stream --schema tableXsd tableXml
                            try {
                                // Pfad zum Programm xmllint existiert die Dateien?
                                String pathToxmllintExe = "resources" + File.separator + "xmllint"
                                        + File.separator + "xmllint.exe";
                                String pathToxmllintDll1 = "resources" + File.separator + "xmllint"
                                        + File.separator + "iconv.dll";
                                String pathToxmllintDll2 = "resources" + File.separator + "xmllint"
                                        + File.separator + "libxml2.dll";
                                String pathToxmllintDll3 = "resources" + File.separator + "xmllint"
                                        + File.separator + "zlib1.dll";

                                File fpathToxmllintExe = new File(pathToxmllintExe);
                                File fpathToxmllintDll1 = new File(pathToxmllintDll1);
                                File fpathToxmllintDll2 = new File(pathToxmllintDll2);
                                File fpathToxmllintDll3 = new File(pathToxmllintDll3);
                                if (!fpathToxmllintExe.exists()) {
                                    getMessageService().logError(getTextResourceService()
                                            .getText(MESSAGE_XML_MODUL_H_SIARD)
                                            + getTextResourceService().getText(ERROR_XML_XMLLINT1_MISSING));
                                    valid = false;
                                } else if (!fpathToxmllintDll1.exists()) {
                                    getMessageService().logError(getTextResourceService()
                                            .getText(MESSAGE_XML_MODUL_H_SIARD)
                                            + getTextResourceService().getText(ERROR_XML_XMLLINT2_MISSING));
                                    valid = false;
                                } else if (!fpathToxmllintDll2.exists()) {
                                    getMessageService().logError(getTextResourceService()
                                            .getText(MESSAGE_XML_MODUL_H_SIARD)
                                            + getTextResourceService().getText(ERROR_XML_XMLLINT3_MISSING));
                                    valid = false;
                                } else if (!fpathToxmllintDll3.exists()) {
                                    getMessageService().logError(getTextResourceService()
                                            .getText(MESSAGE_XML_MODUL_H_SIARD)
                                            + getTextResourceService().getText(ERROR_XML_XMLLINT4_MISSING));
                                    valid = false;
                                } else {

                                    StringBuffer command = new StringBuffer("resources" + File.separator
                                            + "xmllint" + File.separator + "xmllint ");
                                    command.append("--noout --stream ");
                                    command.append(" --schema ");
                                    command.append(" ");
                                    command.append("\"");
                                    command.append(tableXsd.getAbsolutePath());
                                    command.append("\"");
                                    command.append(" ");
                                    command.append("\"");
                                    command.append(tableXml.getAbsolutePath());
                                    command.append("\"");

                                    Process proc = null;
                                    Runtime rt = null;

                                    try {
                                        File outTableXml = new File(pathToWorkDir + File.separator + "SIARD_H_"
                                                + tableXml.getName() + ".txt");

                                        Util.switchOffConsoleToTxt(outTableXml);

                                        rt = Runtime.getRuntime();
                                        proc = rt.exec(command.toString().split(" "));
                                        // .split(" ") ist notwendig wenn in einem Pfad ein Doppelleerschlag vorhanden
                                        // ist!

                                        // Fehleroutput holen

                                        StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(),
                                                "ERROR-" + tableXml.getName());

                                        // Output holen
                                        StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(),
                                                "OUTPUT-" + tableXml.getName());

                                        // Threads starten
                                        errorGobbler.start();
                                        outputGobbler.start();

                                        // Warte, bis wget fertig ist 0 = Alles io
                                        int exitStatus = proc.waitFor();

                                        // 200ms warten bis die Konsole umgeschaltet wird, damit wirklich alles im
                                        // file landet
                                        Thread.sleep(200);
                                        Util.switchOnConsole();

                                        if (0 != exitStatus) {
                                            // message.xml.h.invalid.xml = <Message>{0} ist invalid zu
                                            // {1}</Message></Error>
                                            getMessageService().logError(
                                                    getTextResourceService().getText(MESSAGE_XML_MODUL_H_SIARD)
                                                            + getTextResourceService().getText(
                                                                    MESSAGE_XML_H_INVALID_XML,
                                                                    tableXml.getName(), tableXsd.getName()));
                                            valid = false;

                                            // Fehlermeldung aus outTableXml auslesen

                                            BufferedReader br = new BufferedReader(new FileReader(outTableXml));
                                            try {
                                                String line = br.readLine();
                                                String linePrev = null;
                                                /* Fehlermeldungen holen, ausser die letzte, die besagt, dass es invalide
                                                 * ist (wurde bereits oben in D, F,E ausgegeben */
                                                while (line != null) {
                                                    if (linePrev != null) {
                                                        getMessageService().logError(getTextResourceService()
                                                                .getText(MESSAGE_XML_MODUL_H_SIARD)
                                                                + getTextResourceService().getText(
                                                                        MESSAGE_XML_H_INVALID_ERROR, linePrev));
                                                    }
                                                    linePrev = line;
                                                    line = br.readLine();
                                                }
                                            } finally {
                                                br.close();

                                                /* Konsole zuerst einmal noch umleiten und die Streams beenden, damit die
                                                 * dateien gelscht werden knnen */
                                                Util.switchOffConsoleToTxtClose(outTableXml);
                                                System.out.println(" . ");
                                                Util.switchOnConsole();
                                                Util.deleteFile(outTableXml);

                                            }
                                        } else {
                                            /* Konsole zuerst einmal noch umleiten und die Streams beenden, damit die
                                             * dateien gelscht werden knnen */
                                            Util.switchOffConsoleToTxtClose(outTableXml);
                                            System.out.println(" . ");
                                            Util.switchOnConsole();
                                            Util.deleteFile(outTableXml);

                                        }
                                        /* Konsole zuerst einmal noch umleiten und die Streams beenden, damit die
                                         * dateien gelscht werden knnen */
                                        Util.switchOffConsoleToTxtClose(outTableXml);
                                        System.out.println(" . ");
                                        Util.switchOnConsole();
                                        Util.deleteFile(outTableXml);

                                    } catch (Exception e) {
                                        getMessageService().logError(
                                                getTextResourceService().getText(MESSAGE_XML_MODUL_H_SIARD)
                                                        + getTextResourceService().getText(ERROR_XML_UNKNOWN,
                                                                e.getMessage()));
                                        return false;
                                    } finally {
                                        if (proc != null) {
                                            closeQuietly(proc.getOutputStream());
                                            closeQuietly(proc.getInputStream());
                                            closeQuietly(proc.getErrorStream());
                                        }
                                    }
                                }
                            } finally {
                            }
                        }
                    }
                    if (onWork == 41) {
                        onWork = 2;
                        System.out.print("H-   ");
                        System.out.print("\r");
                    } else if (onWork == 11) {
                        onWork = 12;
                        System.out.print("H\\   ");
                        System.out.print("\r");
                    } else if (onWork == 21) {
                        onWork = 22;
                        System.out.print("H|   ");
                        System.out.print("\r");
                    } else if (onWork == 31) {
                        onWork = 32;
                        System.out.print("H/   ");
                        System.out.print("\r");
                    } else {
                        onWork = onWork + 1;
                    }
                }
            }
            if (onWork == 41) {
                onWork = 2;
                System.out.print("H-   ");
                System.out.print("\r");
            } else if (onWork == 11) {
                onWork = 12;
                System.out.print("H\\   ");
                System.out.print("\r");
            } else if (onWork == 21) {
                onWork = 22;
                System.out.print("H|   ");
                System.out.print("\r");
            } else if (onWork == 31) {
                onWork = 32;
                System.out.print("H/   ");
                System.out.print("\r");
            } else {
                onWork = onWork + 1;
            }
        }
    } catch (java.io.IOException ioe) {
        valid = false;
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_H_SIARD)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, ioe.getMessage() + " (IOException)"));
    } catch (JDOMException e) {
        valid = false;
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_H_SIARD)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage() + " (JDOMException)"));
    } catch (SAXException e) {
        valid = false;
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_H_SIARD)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage() + " (SAXException)"));
    }

    return valid;
}

From source file:ch.kostceco.tools.siardexcerpt.excerption.moduleexcerpt.impl.ExcerptCGrepModuleImpl.java

License:Open Source License

@Override
public boolean validate(File siardDatei, File outFile, String excerptString) throws ExcerptCGrepException {
    // Ausgabe -> Ersichtlich das SIARDexcerpt arbeitet
    int onWork = 41;

    boolean isValid = true;

    File fGrepExe = new File("resources" + File.separator + "grep" + File.separator + "grep.exe");
    String pathToGrepExe = fGrepExe.getAbsolutePath();
    if (!fGrepExe.exists()) {
        // grep.exe existiert nicht --> Abbruch
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                + getTextResourceService().getText(ERROR_XML_C_MISSINGFILE, fGrepExe.getAbsolutePath()));
        return false;
    } else {/*w w  w  .j a  v a  2  s .  c o  m*/
        File fMsys10dll = new File("resources" + File.separator + "grep" + File.separator + "msys-1.0.dll");
        if (!fMsys10dll.exists()) {
            // msys-1.0.dll existiert nicht --> Abbruch
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                    + getTextResourceService().getText(ERROR_XML_C_MISSINGFILE, fMsys10dll.getAbsolutePath()));
            return false;
        }
    }

    File tempOutFile = new File(outFile.getAbsolutePath() + ".tmp");
    String content = "";

    // Record aus Maintable herausholen
    try {
        if (tempOutFile.exists()) {
            Util.deleteDir(tempOutFile);
        }

        /* Nicht vergessen in "src/main/resources/config/applicationContext-services.xml" beim
         * entsprechenden Modul die property anzugeben: <property name="configurationService"
         * ref="configurationService" /> */

        String name = getConfigurationService().getMaintableName();
        String folder = getConfigurationService().getMaintableFolder();
        String cell = getConfigurationService().getMaintablePrimarykeyCell();

        File fMaintable = new File(siardDatei.getAbsolutePath() + File.separator + "content" + File.separator
                + "schema0" + File.separator + folder + File.separator + folder + ".xml");

        try {
            // grep "<c11>7561234567890</c11>" table13.xml >> output.txt
            String command = "cmd /c \"" + pathToGrepExe + " \"<" + cell + ">" + excerptString + "</" + cell
                    + ">\" " + fMaintable.getAbsolutePath() + " >> " + tempOutFile.getAbsolutePath() + "\"";
            /* Das redirect Zeichen verunmglicht eine direkte eingabe. mit dem geschachtellten Befehl
             * gehts: cmd /c\"urspruenlicher Befehl\" */

            // System.out.println( command );

            Process proc = null;
            Runtime rt = null;

            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_OPEN, name));

            try {
                Util.switchOffConsole();
                rt = Runtime.getRuntime();
                proc = rt.exec(command.toString().split(" "));
                // .split(" ") ist notwendig wenn in einem Pfad ein Doppelleerschlag vorhanden ist!

                // Fehleroutput holen
                StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");

                // Output holen
                StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");

                // Threads starten
                errorGobbler.start();
                outputGobbler.start();

                // Warte, bis wget fertig ist
                proc.waitFor();

                Util.switchOnConsole();

            } catch (Exception e) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                        + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
                return false;
            } finally {
                if (proc != null) {
                    closeQuietly(proc.getOutputStream());
                    closeQuietly(proc.getInputStream());
                    closeQuietly(proc.getErrorStream());
                }
            }

            Scanner scanner = new Scanner(tempOutFile);
            content = "";
            try {
                content = scanner.useDelimiter("\\Z").next();
            } catch (Exception e) {
                // Grep ergab kein treffer Content Null
                content = "";
            }
            scanner.close();

            getMessageService()
                    .logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_CONTENT, content));
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_CLOSE, name));

            if (tempOutFile.exists()) {
                Util.deleteDir(tempOutFile);
            }
            content = "";

            // Ende Grep

        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                    + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
            return false;
        }

    } catch (Exception e) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
        return false;
    }

    // Ende MainTable

    // grep der SubTables
    try {
        String name = null;
        String folder = null;
        String cell = null;

        InputStream fin = new FileInputStream(
                new File("configuration" + File.separator + "SIARDexcerpt.conf.xml"));
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(fin);
        fin.close();

        /* read the document and for each subTable */
        Namespace ns = Namespace.getNamespace("");

        // select schema elements and loop
        List<Element> subtables = document.getRootElement().getChild("subtables", ns).getChildren("subtable",
                ns);
        for (Element subtable : subtables) {
            name = subtable.getChild("name", ns).getText();
            folder = subtable.getChild("folder", ns).getText();
            cell = subtable.getChild("foreignkeycell", ns).getText();

            // System.out.println( name + " - " + folder + " - " + cell );
            File fSubtable = new File(siardDatei.getAbsolutePath() + File.separator + "content" + File.separator
                    + "schema0" + File.separator + folder + File.separator + folder + ".xml");

            try {
                // grep "<c11>7561234567890</c11>" table13.xml >> output.txt
                String command = "cmd /c \"" + pathToGrepExe + " \"<" + cell + ">" + excerptString + "</" + cell
                        + ">\" " + fSubtable.getAbsolutePath() + " >> " + tempOutFile.getAbsolutePath() + "\"";
                /* Das redirect Zeichen verunmglicht eine direkte eingabe. mit dem geschachtellten Befehl
                 * gehts: cmd /c\"urspruenlicher Befehl\" */

                // System.out.println( command );

                Process proc = null;
                Runtime rt = null;

                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_OPEN, name));

                try {
                    Util.switchOffConsole();
                    rt = Runtime.getRuntime();
                    proc = rt.exec(command.toString().split(" "));
                    // .split(" ") ist notwendig wenn in einem Pfad ein Doppelleerschlag vorhanden ist!

                    // Fehleroutput holen
                    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");

                    // Output holen
                    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");

                    // Threads starten
                    errorGobbler.start();
                    outputGobbler.start();

                    // Warte, bis wget fertig ist
                    proc.waitFor();

                    Util.switchOnConsole();

                } catch (Exception e) {
                    getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                            + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
                    return false;
                } finally {
                    if (proc != null) {
                        closeQuietly(proc.getOutputStream());
                        closeQuietly(proc.getInputStream());
                        closeQuietly(proc.getErrorStream());
                    }
                }

                Scanner scanner = new Scanner(tempOutFile);
                content = "";
                try {
                    content = scanner.useDelimiter("\\Z").next();
                } catch (Exception e) {
                    // Grep ergab kein treffer Content Null
                    content = "";
                }
                scanner.close();

                getMessageService()
                        .logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_CONTENT, content));
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_ELEMENT_CLOSE, name));

                if (tempOutFile.exists()) {
                    Util.deleteDir(tempOutFile);
                }
                content = "";

                // Ende Grep

            } catch (Exception e) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                        + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
                return false;
            }

            // Ende SubTables
            if (onWork == 41) {
                onWork = 2;
                System.out.print("-   ");
                System.out.print("\r");
            } else if (onWork == 11) {
                onWork = 12;
                System.out.print("\\   ");
                System.out.print("\r");
            } else if (onWork == 21) {
                onWork = 22;
                System.out.print("|   ");
                System.out.print("\r");
            } else if (onWork == 31) {
                onWork = 32;
                System.out.print("/   ");
                System.out.print("\r");
            } else {
                onWork = onWork + 1;
            }
        }
        System.out.print("   ");
        System.out.print("\r");
    } catch (Exception e) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
        return false;
    }

    return isValid;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationFrowModuleImpl.java

License:Open Source License

private boolean prepareValidationData(Properties properties, File metadataXML)
        throws JDOMException, IOException {
    boolean successfullyCommitted = false;
    String me = "[F.0.6] prepareValidationData (Properties properties, File metadataXML) ";
    //Initializing validation Logging
    StringBuilder validationLog = new StringBuilder();
    //Gets the tables to be validated
    List<SiardTable> siardTables = new ArrayList<SiardTable>();
    Document document = this.getMetadataXMLDocument();
    Element rootElement = document.getRootElement();
    String workingDirectory = this.getConfigurationService().getPathToWorkDir();
    String siardSchemasElementsName = properties.getProperty("module.f.siard.metadata.xml.schemas.name");
    //Gets the list of <schemas> elements from metadata.xml
    List<Element> siardSchemasElements = rootElement.getChildren(siardSchemasElementsName,
            this.getXmlNamespace());
    for (Element siardSchemasElement : siardSchemasElements) {
        //Gets the list of <schema> elements from metadata.xml
        List<Element> siardSchemaElements = siardSchemasElement.getChildren(
                properties.getProperty("module.f.siard.metadata.xml.schema.name"), this.getXmlNamespace());
        //Iterating over all <schema> elements
        for (Element siardSchemaElement : siardSchemaElements) {
            String schemaFolderName = siardSchemaElement
                    .getChild(properties.getProperty("module.f.siard.metadata.xml.schema.folder.name"),
                            this.getXmlNamespace())
                    .getValue();/*  w w w .  j a  v  a 2s.  co  m*/
            Element siardTablesElement = siardSchemaElement.getChild(
                    properties.getProperty("module.f.siard.metadata.xml.tables.name"), this.getXmlNamespace());
            List<Element> siardTableElements = siardTablesElement.getChildren(
                    properties.getProperty("module.f.siard.metadata.xml.table.name"), this.getXmlNamespace());
            //Iterating over all containing table elements
            for (Element siardTableElement : siardTableElements) {
                Element siardColumnsElement = siardTableElement.getChild(
                        properties.getProperty("module.f.siard.metadata.xml.columns.name"),
                        this.getXmlNamespace());
                List<Element> siardColumnElements = siardColumnsElement.getChildren(
                        properties.getProperty("module.f.siard.metadata.xml.column.name"),
                        this.getXmlNamespace());
                String tableName = siardTableElement
                        .getChild(properties.getProperty("module.f.siard.metadata.xml.table.folder.name"),
                                this.getXmlNamespace())
                        .getValue();
                //SiardTable siardTable = new SiardTable();
                //Decoupling dependency to SiardTable Bean by injecting it via Spring
                SiardTable siardTable = this.getSiardTable();
                siardTable.setMetadataXMLElements(siardColumnElements);
                siardTable.setTableName(tableName);
                String siardTableFolderName = siardTableElement
                        .getChild(properties.getProperty("module.f.siard.metadata.xml.table.folder.name"),
                                this.getXmlNamespace())
                        .getValue();
                StringBuilder pathToTableSchema = new StringBuilder();
                StringBuilder pathToTableData = new StringBuilder();
                //Preparing access to the according XML schema file
                pathToTableSchema.append(workingDirectory);
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(properties.getProperty("module.f.siard.path.to.content"));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(schemaFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(properties.getProperty("module.f.siard.table.xsd.file.extension"));
                //Preparing access to the table XML data file
                pathToTableData.append(workingDirectory);
                pathToTableData.append(File.separator);
                pathToTableData.append(properties.getProperty("module.f.siard.path.to.content"));
                pathToTableData.append(File.separator);
                pathToTableData.append(schemaFolderName.replaceAll(" ", ""));
                pathToTableData.append(File.separator);
                pathToTableData.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableData.append(File.separator);
                pathToTableData.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableData.append(properties.getProperty("module.f.siard.table.xml.file.extension"));
                //Retrieve the according XML schema
                File tableSchema = this.getSiardFiles().get(pathToTableSchema.toString());
                File tableData = this.getSiardFiles().get(pathToTableData.toString());
                SAXBuilder builder = new SAXBuilder();
                Document tableSchemaDocument = builder.build(tableSchema);
                Document tableDataDocument = builder.build(tableData);
                Element tableSchemaRootElement = tableSchemaDocument.getRootElement();
                Element tableDataRootElement = tableDataDocument.getRootElement();
                Namespace xsdNamespace = tableSchemaRootElement.getNamespace();
                Namespace xmlNamespace = tableDataRootElement.getNamespace();
                //Getting the tags from XML schema to be validated
                Element tableSchemaComplexType = tableSchemaRootElement
                        .getChild(properties.getProperty("module.f.siard.table.xsd.complexType"), xsdNamespace);
                Element tableSchemaComplexTypeSequence = tableSchemaComplexType
                        .getChild(properties.getProperty("module.f.siard.table.xsd.sequence"), xsdNamespace);
                Element tableDataComplexType = tableDataRootElement
                        .getChild(properties.getProperty("module.f.siard.table.xml.complexType"), xmlNamespace);
                Element tableDataComplexTypeSequence = tableDataComplexType
                        .getChild(properties.getProperty("module.f.siard.table.xml.sequence"), xmlNamespace);
                List<Element> tableSchemaComplexTypeElements = tableSchemaComplexTypeSequence
                        .getChildren(properties.getProperty("module.f.siard.table.xsd.element"), xsdNamespace);
                List<Element> tableDataComplexTypeElements = tableDataComplexTypeSequence
                        .getChildren(properties.getProperty("module.f.siard.table.xml.element"), xmlNamespace);
                siardTable.setTableXSDElements(tableSchemaComplexTypeElements);
                siardTable.setTableXMLElements(tableDataComplexTypeElements);
                siardTables.add(siardTable);
                //Writing back the List off all SIARD tables to the validation context
                this.setSiardTables(siardTables);
            }
        }
    }
    if (this.getSiardTables() != null && properties != null && metadataXML != null) {
        //Updating the validation log
        String message = properties.getProperty("successfully.executed");
        String newline = properties.getProperty("newline");
        validationLog.append(me + message);
        validationLog.append(newline);
        successfullyCommitted = true;
    } else {
        String message = "has failed";
        validationLog.append(me + message);
        validationLog.append('\n');
    }
    this.getValidationLog().append(validationLog);
    return successfullyCommitted;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationDstructureModuleImpl.java

License:Open Source License

private boolean validateSchema(Element schema, Namespace ns, String pathToWorkDir) {
    boolean valid = true;
    Element schemaFolder = schema.getChild("folder", ns);
    File schemaPath = new File(new StringBuilder(pathToWorkDir).append(File.separator).append("content")
            .append(File.separator).append(schemaFolder.getText()).toString());
    if (schemaPath.isDirectory()) {
        List<Element> tables = schema.getChild("tables", ns).getChildren("table", ns);
        for (Element table : tables) {
            valid = valid && validateTable(table, ns, pathToWorkDir, schemaPath);
        }//from   w  w w.java2s. c  o m
    } else {
        valid = false;
        if (schemaPath.exists()) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_MODULE_D)
                    + getTextResourceService().getText(MESSAGE_DASHES)
                    + getTextResourceService().getText("content" + " " + MESSAGE_MODULE_D_INVALID_FOLDER) + " "
                    + schemaPath.getName() + " in ");
        } else {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_MODULE_D)
                    + getTextResourceService().getText(MESSAGE_DASHES)
                    + getTextResourceService().getText(MESSAGE_MODULE_D_MISSING_FOLDER) + " " + "content" + ": "
                    + schemaPath.getName());
        }
    }
    return valid;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationDstructureModuleImpl.java

License:Open Source License

private boolean validateTable(Element table, Namespace ns, String pathToWorkDir, File schemaPath) {
    boolean valid = true;
    Element tableFolder = table.getChild("folder", ns);
    File tablePath = new File(new StringBuilder(schemaPath.getAbsolutePath()).append(File.separator)
            .append(tableFolder.getText()).toString());
    if (tablePath.isDirectory()) {
        File tableXml = new File(new StringBuilder(tablePath.getAbsolutePath()).append(File.separator)
                .append(tableFolder.getText() + ".xml").toString());
        valid = valid && validateFile(tableXml, tablePath);
        File tableXsd = new File(new StringBuilder(tablePath.getAbsolutePath()).append(File.separator)
                .append(tableFolder.getText() + ".xsd").toString());
        valid = valid && validateFile(tableXsd, tablePath);
    } else {/* w ww.  ja  v a 2  s. c o m*/
        valid = false;
        if (tablePath.exists()) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_MODULE_D)
                    + getTextResourceService().getText(MESSAGE_DASHES)
                    + getTextResourceService()
                            .getText(schemaPath.getName() + " " + MESSAGE_MODULE_D_INVALID_FOLDER)
                    + " " + tablePath.getName() + " in ");
        } else {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_MODULE_D)
                    + getTextResourceService().getText(MESSAGE_DASHES)
                    + getTextResourceService().getText(MESSAGE_MODULE_D_MISSING_FOLDER) + " "
                    + schemaPath.getName() + ": " + tablePath.getName());
        }
    }
    return valid;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationEcolumnModuleImpl.java

License:Open Source License

private boolean validateColumnOccurrence(ValidationContext validationContext) throws Exception {
    boolean validTable;
    boolean validDatabase;
    Properties properties = validationContext.getValidationProperties();
    List<SiardTable> siardTables = validationContext.getSiardTables();
    StringBuilder namesOfInvalidTables = new StringBuilder();
    StringBuilder namesOfInvalidColumns = new StringBuilder();
    validDatabase = true;/*w w w  .jav a  2 s  . co  m*/
    // Iterate over the SIARD tables and verify the nullable attribute
    for (SiardTable siardTable : siardTables) {
        String nullable = new String();
        String minOccurs = new String();
        validTable = true;
        // Number of attributes in metadata.xml
        int metadataXMLColumnsCount = siardTable.getMetadataXMLElements().size();
        // Number of attributes in schema.xsd
        int tableXSDColumnsCount = siardTable.getTableXSDElements().size();
        // Counter. In order to prevent indexOutOfBorder errors
        // columnsCounter is assigned to the smaller
        // number of columns
        int columnCount = (metadataXMLColumnsCount >= tableXSDColumnsCount) ? tableXSDColumnsCount
                : metadataXMLColumnsCount;
        // Element/Attributes of the actual SIARD table
        List<Element> xmlElements = siardTable.getMetadataXMLElements();
        // Elements/Attributes of the according XML schema
        List<Element> xsdElements = siardTable.getTableXSDElements();
        Namespace xmlNamespace = validationContext.getXmlNamespace();
        for (int i = 0; i < columnCount; i++) {
            // for ( int i = 0; i < metadataXMLColumnsCount; i++) {
            // Actual Element of the metadata.xml
            Element xmlElement = xmlElements.get(i);
            // Actual Element of the according XML schema
            Element xsdElement = xsdElements.get(i);
            String nullableElementDescription = properties
                    .getProperty("module.e.siard.metadata.xml.nullable.element.name");
            String minuOccursAttributeDescription = properties
                    .getProperty("module.e.siard.table.xsd.attribute.minOccurs.name");
            String nameAttributeDescription = properties.getProperty("module.e.siard.table.xsd.attribute.name");
            // Value of the nullable Element in metadata.xml
            nullable = xmlElement.getChild(nullableElementDescription, xmlNamespace).getValue();
            // Value of the minOccurs attribute in the according XML schema
            minOccurs = xsdElement.getAttributeValue(minuOccursAttributeDescription);
            // If the nullable Element is set to true and the minOccurs
            // attribute is null
            if (nullable.equalsIgnoreCase("true") && minOccurs == null) {
                validTable = false;
                validDatabase = false;
                namesOfInvalidColumns.append((namesOfInvalidColumns.length() > 0) ? ", " : "");
                namesOfInvalidColumns.append(xsdElement.getAttributeValue(nameAttributeDescription));
                // If the nullable Element is set to true and the minOccurs
                // attribute is set to zero
            } else if (nullable.equalsIgnoreCase("true") && minOccurs.equalsIgnoreCase("0")) {
            } else if (nullable.equalsIgnoreCase("false") && minOccurs == null) {
            } else if (nullable.equalsIgnoreCase("false") && minOccurs.equalsIgnoreCase("0")) {
                validTable = false;
                validDatabase = false;
                namesOfInvalidColumns.append((namesOfInvalidColumns.length() > 0) ? ", " : "");
                namesOfInvalidColumns.append(xsdElement.getAttributeValue(nameAttributeDescription));
            }
        }
        if (validTable == false) {
            namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
            namesOfInvalidTables.append(siardTable.getTableName());
            namesOfInvalidTables.append(properties.getProperty("module.e.siard.table.xsd.file.extension"));
            namesOfInvalidTables.append("(");
            namesOfInvalidTables.append(namesOfInvalidColumns);
            namesOfInvalidTables.append(")");
            namesOfInvalidColumns = null;
            namesOfInvalidColumns = new StringBuilder();
        }
    }
    // Writing back error log
    this.setIncongruentColumnOccurrence(namesOfInvalidTables);
    return validDatabase;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationEcolumnModuleImpl.java

License:Open Source License

private boolean validateColumnType(ValidationContext validationContext) throws Exception {
    boolean validTable;
    boolean validDatabase;
    Properties properties = validationContext.getValidationProperties();
    List<SiardTable> siardTables = validationContext.getSiardTables();
    StringBuilder namesOfInvalidTables = new StringBuilder();
    StringBuilder namesOfInvalidColumns = new StringBuilder();
    // List of all XML column elements to verify the allover sequence
    List<String> xmlElementSequence = new ArrayList<String>();
    // List of all XSD column elements
    List<String> xsdElementSequence = new ArrayList<String>();
    // Iterate over the SIARD tables and verify the column types
    validDatabase = true;//www .  j a  v  a 2s. c  om
    for (SiardTable siardTable : siardTables) {
        // Elements of the actual SIARD table
        List<Element> xmlElements = siardTable.getMetadataXMLElements();
        // Elements of the according XML schema
        List<Element> xsdElements = siardTable.getTableXSDElements();
        // Number of attributes in metadata.xml
        int metadataXMLColumnsCount = xmlElements.size();
        // Number of attributes in schema.xsd
        int tableXSDColumnsCount = xsdElements.size();
        // Counter. In order to prevent indexOutOfBorder errors
        // columnsCounter is assigned to the smaller
        // number of columns
        int columnCount = (metadataXMLColumnsCount >= tableXSDColumnsCount) ? tableXSDColumnsCount
                : metadataXMLColumnsCount;
        validTable = true;
        // Verify whether the number of column elements in XML and XSD are
        // equal
        for (int i = 0; i < columnCount; i++) {
            Element xmlElement = xmlElements.get(i);
            Element xsdElement = xsdElements.get(i);
            // Retrieve the Elements name
            String xmlTypeElementName = properties.getProperty("module.e.siard.metadata.xml.type.element.name");
            String xsdTypeAttribute = properties.getProperty("module.e.siard.table.xsd.type.attribute.name");
            String xsdAttribute = properties.getProperty("module.e.siard.table.xsd.attribute.name");
            String columnName = xsdElement.getAttributeValue(xsdAttribute);
            // Retrieve the original column type from metadata.xml
            String leftSide = xmlElement.getChild(xmlTypeElementName, validationContext.getXmlNamespace())
                    .getValue();
            // Retrieve the original column type from table.xsd
            String rightSide = xsdElement.getAttributeValue(xsdTypeAttribute);
            String delimiter = properties
                    .getProperty("module.e.attribute.type.validator.original.type.delimiter");
            // Trim the column types - eliminates the brackets and specific
            // numeric parameters
            String trimmedExpectedType = trimLeftSideType(leftSide, delimiter);
            // Designing expected column type in table.xsd, called
            // "rightSide"
            String expectedType = properties.getProperty(trimmedExpectedType);
            // In case the expected type does not exist
            if (expectedType == null) {
                expectedType = properties.getProperty("module.e.type.validator.unknown.type");
                validTable = false;
                validDatabase = false;
                namesOfInvalidColumns.append((namesOfInvalidColumns.length() > 0) ? ", " : "");
                namesOfInvalidColumns.append(columnName + "{" + expectedType + "}");
            } else if (!expectedType.equalsIgnoreCase(rightSide) && expectedType != null) {
                validTable = false;
                validDatabase = false;
                namesOfInvalidColumns.append((namesOfInvalidColumns.length() > 0) ? ", " : "");
                namesOfInvalidColumns.append(columnName);
            }
            // Convey the column types for the all over sequence test [E.4]
            xmlElementSequence.add(expectedType);
            xsdElementSequence.add(rightSide);
        }
        if (validTable == false) {
            namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
            namesOfInvalidTables.append(siardTable.getTableName());
            namesOfInvalidTables.append(properties.getProperty("module.e.siard.table.xsd.file.extension"));
            namesOfInvalidTables.append("(");
            namesOfInvalidTables.append(namesOfInvalidColumns);
            namesOfInvalidTables.append(")");
            namesOfInvalidColumns = null;
            namesOfInvalidColumns = new StringBuilder();
        }
    }
    this.setIncongruentColumnType(namesOfInvalidTables);
    // Save the allover column elements for [E.4]
    validationContext.setXmlElementsSequence(xmlElementSequence);
    validationContext.setXsdElementsSequence(xsdElementSequence);
    this.setValidationContext(validationContext);
    // Return the current validation state
    return validDatabase;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationEcolumnModuleImpl.java

License:Open Source License

private boolean prepareValidationData(ValidationContext validationContext)
        throws JDOMException, IOException, Exception {
    boolean successfullyCommitted = false;
    Properties properties = validationContext.getValidationProperties();
    // Gets the tables to be validated
    List<SiardTable> siardTables = new ArrayList<SiardTable>();
    Document document = validationContext.getMetadataXMLDocument();
    Element rootElement = document.getRootElement();
    String workingDirectory = validationContext.getConfigurationService().getPathToWorkDir();
    String siardSchemasElementsName = properties.getProperty("module.e.siard.metadata.xml.schemas.name");
    // Gets the list of <schemas> elements from metadata.xml
    List<Element> siardSchemasElements = rootElement.getChildren(siardSchemasElementsName,
            validationContext.getXmlNamespace());
    for (Element siardSchemasElement : siardSchemasElements) {
        // Gets the list of <schema> elements from metadata.xml
        List<Element> siardSchemaElements = siardSchemasElement.getChildren(
                properties.getProperty("module.e.siard.metadata.xml.schema.name"),
                validationContext.getXmlNamespace());
        // Iterating over all <schema> elements
        for (Element siardSchemaElement : siardSchemaElements) {
            String schemaFolderName = siardSchemaElement
                    .getChild(properties.getProperty("module.e.siard.metadata.xml.schema.folder.name"),
                            validationContext.getXmlNamespace())
                    .getValue();//from  ww  w .  ja  v  a2 s  . c om
            Element siardTablesElement = siardSchemaElement.getChild(
                    properties.getProperty("module.e.siard.metadata.xml.tables.name"),
                    validationContext.getXmlNamespace());
            List<Element> siardTableElements = siardTablesElement.getChildren(
                    properties.getProperty("module.e.siard.metadata.xml.table.name"),
                    validationContext.getXmlNamespace());
            // Iterating over all containing table elements
            for (Element siardTableElement : siardTableElements) {
                Element siardColumnsElement = siardTableElement.getChild(
                        properties.getProperty("module.e.siard.metadata.xml.columns.name"),
                        validationContext.getXmlNamespace());
                List<Element> siardColumnElements = siardColumnsElement.getChildren(
                        properties.getProperty("module.e.siard.metadata.xml.column.name"),
                        validationContext.getXmlNamespace());
                String tableName = siardTableElement
                        .getChild(properties.getProperty("module.e.siard.metadata.xml.table.folder.name"),
                                validationContext.getXmlNamespace())
                        .getValue();
                SiardTable siardTable = new SiardTable();
                siardTable.setMetadataXMLElements(siardColumnElements);
                siardTable.setTableName(tableName);
                String siardTableFolderName = siardTableElement
                        .getChild(properties.getProperty("module.e.siard.metadata.xml.table.folder.name"),
                                validationContext.getXmlNamespace())
                        .getValue();
                StringBuilder pathToTableSchema = new StringBuilder();
                // Preparing access to the according XML schema file
                pathToTableSchema.append(workingDirectory);
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(properties.getProperty("module.e.siard.path.to.content"));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(schemaFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(File.separator);
                pathToTableSchema.append(siardTableFolderName.replaceAll(" ", ""));
                pathToTableSchema.append(properties.getProperty("module.e.siard.table.xsd.file.extension"));
                // Retrieve the according XML schema
                File tableSchema = validationContext.getSiardFiles().get(pathToTableSchema.toString());
                SAXBuilder builder = new SAXBuilder();
                Document tableSchemaDocument = builder.build(tableSchema);
                Element tableSchemaRootElement = tableSchemaDocument.getRootElement();
                Namespace namespace = tableSchemaRootElement.getNamespace();
                // Getting the tags from XML schema to be validated
                Element tableSchemaComplexType = tableSchemaRootElement
                        .getChild(properties.getProperty("module.e.siard.table.xsd.complexType"), namespace);
                Element tableSchemaComplexTypeSequence = tableSchemaComplexType
                        .getChild(properties.getProperty("module.e.siard.table.xsd.sequence"), namespace);
                List<Element> tableSchemaComplexTypeElements = tableSchemaComplexTypeSequence
                        .getChildren(properties.getProperty("module.e.siard.table.xsd.element"), namespace);
                siardTable.setTableXSDElements(tableSchemaComplexTypeElements);
                siardTables.add(siardTable);
                // Writing back the List off all SIARD tables to the
                // validation context
                validationContext.setSiardTables(siardTables);
            }
        }
    }
    if (validationContext.getSiardTables().size() > 0) {
        this.setValidationContext(validationContext);
        successfullyCommitted = true;
    } else {
        this.setValidationContext(null);
        successfullyCommitted = false;
        throw new Exception();
    }
    return successfullyCommitted;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationFrowModuleImpl.java

License:Open Source License

private boolean validateTableXMLFiles(ValidationContext validationContext) throws Exception {
    boolean validTableXMLFiles = true;
    StringBuilder namesOfInvalidTables = new StringBuilder();
    Properties properties = validationContext.getValidationProperties();
    List<SiardTable> siardTables = validationContext.getSiardTables();

    for (SiardTable siardTable : siardTables) {
        Element tableRootElement = siardTable.getTableRootElement();
        Element tableRowsElement = tableRootElement.getChild(
                properties.getProperty("module.f.siard.table.xml.rows.element.name"),
                validationContext.getXmlNamespace());
        Integer rowNumber = new Integer(tableRowsElement.getValue());
        List<Element> xmlRowElements = siardTable.getTableXMLElements();
        Integer rows = new Integer(xmlRowElements.size());
        if (rowNumber > rows) {
            validTableXMLFiles = false;/*from  w ww . j ava  2s.  c  o m*/
            namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
            namesOfInvalidTables.append(siardTable.getTableName()
                    + properties.getProperty("module.f.siard.table.xml.file.extension") + " ("
                    + (rows - rowNumber) + ") ");
        }

        if (rowNumber < rows) {
            validTableXMLFiles = false;
            namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
            namesOfInvalidTables.append(siardTable.getTableName()
                    + properties.getProperty("module.f.siard.table.xml.file.extension") + " (+"
                    + (rows - rowNumber) + ") ");
        }
    }
    // Writing back error log
    this.setIncongruentTableXMLFiles(namesOfInvalidTables);
    // Return the current validation state
    return validTableXMLFiles;
}

From source file:ch.kostceco.tools.siardval.validation.module.impl.ValidationFrowModuleImpl.java

License:Open Source License

private boolean validateTableXSDFiles(ValidationContext validationContext) throws Exception {
    boolean validTableXSDFiles = true;
    StringBuilder namesOfInvalidTables = new StringBuilder();
    Properties properties = validationContext.getValidationProperties();
    List<SiardTable> siardTables = validationContext.getSiardTables();

    for (SiardTable siardTable : siardTables) {

        Element tableRootElement = siardTable.getTableRootElement();
        Element tableRowsElement = tableRootElement.getChild(
                properties.getProperty("module.f.siard.table.xml.rows.element.name"),
                validationContext.getXmlNamespace());
        Integer rowNumber = new Integer(tableRowsElement.getValue());
        Long extendedRowNumber = rowNumber.longValue();

        Element tableXSDRootElement = siardTable.getTableXSDRootElement();
        Element tableElement = tableXSDRootElement.getChild(
                properties.getProperty("module.f.siard.table.xsd.element"), tableXSDRootElement.getNamespace());

        Element tableComplexType = tableElement.getChild(
                properties.getProperty("module.f.siard.table.xsd.complexType"),
                tableXSDRootElement.getNamespace());

        Element tableSequence = tableComplexType.getChild(
                properties.getProperty("module.f.siard.table.xsd.sequence"),
                tableXSDRootElement.getNamespace());

        String maxOccurs = tableSequence
                .getChild(properties.getProperty("module.f.siard.table.xsd.element"),
                        tableXSDRootElement.getNamespace())
                .getAttributeValue(properties.getProperty("module.f.siard.table.xsd.attribute.maxOccurs.name"));
        String minOccurs = tableSequence
                .getChild(properties.getProperty("module.f.siard.table.xsd.element"),
                        tableXSDRootElement.getNamespace())
                .getAttributeValue(properties.getProperty("module.f.siard.table.xsd.attribute.minOccurs.name"));

        // Implicite max. bound: the maximal value of Long is used
        if (maxOccurs
                .equalsIgnoreCase(properties.getProperty("module.f.siard.table.xsd.attribute.unbounded"))) {
            if (extendedRowNumber >= 0 && extendedRowNumber <= Long.MAX_VALUE) {
            } else {
                validTableXSDFiles = false;
                namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
                namesOfInvalidTables.append(siardTable.getTableName()
                        + properties.getProperty("module.f.siard.table.xsd.file.extension"));
            }/* ww w  .ja v a  2 s  .  c o  m*/
        }

        // Explicite max. bound is used
        if (isLong(maxOccurs) && isLong(minOccurs)) {
            if (new Long(minOccurs) == extendedRowNumber && new Long(maxOccurs) == extendedRowNumber) {
            } else {
                if (new Long(minOccurs) - extendedRowNumber == 0
                        && new Long(maxOccurs) - extendedRowNumber == 0) {
                } else {
                    if (new Long(maxOccurs) > extendedRowNumber) {
                        validTableXSDFiles = false;
                        namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
                        namesOfInvalidTables.append(siardTable.getTableName()
                                + properties.getProperty("module.f.siard.table.xsd.file.extension") + " (+"
                                + (new Long(maxOccurs) - extendedRowNumber) + ") ");

                    } else {
                        validTableXSDFiles = false;
                        namesOfInvalidTables.append((namesOfInvalidTables.length() > 0) ? ", " : "");
                        namesOfInvalidTables.append(siardTable.getTableName()
                                + properties.getProperty("module.f.siard.table.xsd.file.extension") + " ("
                                + (new Long(maxOccurs) - extendedRowNumber) + ") ");
                    }
                }
            }
        }
    }

    this.setIncongruentTableXSDFiles(namesOfInvalidTables);
    return validTableXSDFiles;
}