Example usage for org.jdom2 Element getNamespace

List of usage examples for org.jdom2 Element getNamespace

Introduction

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

Prototype

public Namespace getNamespace() 

Source Link

Document

Returns the element's Namespace .

Usage

From source file:ca.nrc.cadc.caom2.xml.ObservationReader.java

License:Open Source License

/**
 * Construct an Observation from a Reader.
 *
 * @param reader//from   www.  j  av  a2 s  .  c om
 *            A Reader.
 * @return An Observation.
 * @throws ObservationParsingException
 *             if there is an error parsing the XML.
 */
public Observation read(Reader reader) throws ObservationParsingException, IOException {
    if (reader == null) {
        throw new IllegalArgumentException("reader must not be null");
    }

    init();

    Document document;
    try {
        document = XmlUtil.buildDocument(reader, schemaMap);
    } catch (JDOMException jde) {
        String error = "XML failed schema validation: " + jde.getMessage();
        throw new ObservationParsingException(error, jde);
    }

    // Root element and namespace of the Document
    Element root = document.getRootElement();
    Namespace namespace = root.getNamespace();
    log.debug("obs namespace uri: " + namespace.getURI());
    log.debug("obs namespace prefix: " + namespace.getPrefix());

    ReadContext rc = new ReadContext();
    if (XmlConstants.CAOM2_0_NAMESPACE.equals(namespace.getURI())) {
        rc.docVersion = 20;
    } else if (XmlConstants.CAOM2_1_NAMESPACE.equals(namespace.getURI())) {
        rc.docVersion = 21;
    } else if (XmlConstants.CAOM2_2_NAMESPACE.equals(namespace.getURI())) {
        rc.docVersion = 22;
    }

    // Simple or Composite
    Attribute type = root.getAttribute("type", xsiNamespace);
    String tval = type.getValue();

    String collection = getChildText("collection", root, namespace, false);
    String observationID = getChildText("observationID", root, namespace, false);

    // Algorithm.
    Algorithm algorithm = getAlgorithm(root, namespace, rc);

    // Create the Observation.
    Observation obs;
    String simple = namespace.getPrefix() + ":" + SimpleObservation.class.getSimpleName();
    String comp = namespace.getPrefix() + ":" + CompositeObservation.class.getSimpleName();
    if (simple.equals(tval)) {
        obs = new SimpleObservation(collection, observationID);
        obs.setAlgorithm(algorithm);
    } else if (comp.equals(tval)) {
        obs = new CompositeObservation(collection, observationID, algorithm);
    } else {
        throw new ObservationParsingException("unexpected observation type: " + tval);
    }

    // Observation children.
    String intent = getChildText("intent", root, namespace, false);
    if (intent != null) {
        obs.intent = ObservationIntentType.toValue(intent);
    }
    obs.type = getChildText("type", root, namespace, false);

    obs.metaRelease = getChildTextAsDate("metaRelease", root, namespace, false, rc.dateFormat);
    obs.sequenceNumber = getChildTextAsInteger("sequenceNumber", root, namespace, false);
    obs.proposal = getProposal(root, namespace, rc);
    obs.target = getTarget(root, namespace, rc);
    obs.targetPosition = getTargetPosition(root, namespace, rc);
    obs.requirements = getRequirements(root, namespace, rc);
    obs.telescope = getTelescope(root, namespace, rc);
    obs.instrument = getInstrument(root, namespace, rc);
    obs.environment = getEnvironment(root, namespace, rc);

    addPlanes(obs.getPlanes(), root, namespace, rc);

    if (obs instanceof CompositeObservation) {
        addMembers(((CompositeObservation) obs).getMembers(), root, namespace, rc);
    }

    assignEntityAttributes(root, obs, rc);

    return obs;
}

From source file:ca.nrc.cadc.caom2.xml.ObservationReader.java

License:Open Source License

private void assignEntityAttributes(Element e, CaomEntity ce, ReadContext rc)
        throws ObservationParsingException {
    Attribute aid = e.getAttribute("id", e.getNamespace());
    Attribute alastModified = e.getAttribute("lastModified", e.getNamespace());
    Attribute amaxLastModified = e.getAttribute("maxLastModified", e.getNamespace());
    Attribute mcs = e.getAttribute("metaChecksum", e.getNamespace());
    Attribute acc = e.getAttribute("accMetaChecksum", e.getNamespace());
    try {/*from  w  w  w . j a  v a  2s  .co  m*/
        UUID uuid;
        if (rc.docVersion == 20) {
            Long id = new Long(aid.getLongValue());
            uuid = new UUID(0L, id);
        } else {
            uuid = UUID.fromString(aid.getValue());
        }

        CaomUtil.assignID(ce, uuid);
        if (alastModified != null) {
            Date lastModified = rc.parseTimestamp(alastModified.getValue());
            CaomUtil.assignLastModified(ce, lastModified, "lastModified");
        }

        if (rc.docVersion >= 23) {
            if (amaxLastModified != null) {
                Date lastModified = rc.parseTimestamp(amaxLastModified.getValue());
                CaomUtil.assignLastModified(ce, lastModified, "maxLastModified");
            }
            if (mcs != null) {
                URI metaCS = new URI(mcs.getValue());
                CaomUtil.assignMetaChecksum(ce, metaCS, "metaChecksum");
            }
            if (acc != null) {
                URI accCS = new URI(acc.getValue());
                CaomUtil.assignMetaChecksum(ce, accCS, "accMetaChecksum");
            }
        }
    } catch (DataConversionException ex) {
        throw new ObservationParsingException("invalid id: " + aid.getValue());
    } catch (ParseException ex) {
        throw new ObservationParsingException("invalid lastModified: " + alastModified.getValue());
    } catch (URISyntaxException ex) {
        throw new ObservationParsingException("invalid checksum uri: " + aid.getValue());
    }
}

From source file:ca.nrc.cadc.caom2.xml.ObservationWriter.java

License:Open Source License

private void addEntityAttributes(CaomEntity ce, Element el, DateFormat df) {
    if (docVersion < 21) {
        el.setAttribute("id", CaomUtil.uuidToLong(ce.getID()).toString(), caom2Namespace);
    } else {//  w  w  w .  j av  a 2 s. c  o m
        el.setAttribute("id", ce.getID().toString(), caom2Namespace);
    }

    if (ce.getLastModified() != null) {
        el.setAttribute("lastModified", df.format(ce.getLastModified()), el.getNamespace());
    }

    if (docVersion >= 23 && ce.getMaxLastModified() != null) {
        el.setAttribute("maxLastModified", df.format(ce.getMaxLastModified()), el.getNamespace());
    }

    if (docVersion >= 23 && ce.getMetaChecksum() != null) {
        el.setAttribute("metaChecksum", ce.getMetaChecksum().toASCIIString(), el.getNamespace());
    }

    if (docVersion >= 23 && ce.getAccMetaChecksum() != null) {
        el.setAttribute("accMetaChecksum", ce.getAccMetaChecksum().toASCIIString(), el.getNamespace());
    }
}

From source file:ca.nrc.cadc.dali.tables.votable.VOTableReader.java

License:Open Source License

/**
 * Read a XML VOTable from a Reader and build a VOTable object.
 *
 * @param reader Reader to read from.//from   ww w.  j a  v  a  2s. c  o m
 * @return a VOTable object.
 * @throws IOException if problem reading from the reader.
 */
public VOTable read(Reader reader) throws IOException {
    // Parse the input document.
    Document document;
    try {
        document = docBuilder.build(reader);
    } catch (JDOMException e) {
        throw new IOException("Unable to parse " + e.getMessage());
    }

    // Returned VOTable object.
    VOTable votable = new VOTable();

    // Document root element.
    Element root = document.getRootElement();

    // Namespace for the root element.
    Namespace namespace = root.getNamespace();
    log.debug("Namespace: " + namespace);

    // RESOURCE element.
    Element resource = root.getChild("RESOURCE", namespace);
    if (resource != null) {
        // Get the RESOURCE name attribute.
        Attribute resourceName = resource.getAttribute("name");
        if (resourceName != null) {
            votable.setResourceName(resourceName.getValue());
        }

        // INFO element.
        List<Element> infos = resource.getChildren("INFO", namespace);
        votable.getInfos().addAll(getInfos(infos, namespace));

        // TABLE element.
        Element table = resource.getChild("TABLE", namespace);
        if (table != null) {
            // PARAM elements.
            List<Element> params = table.getChildren("PARAM", namespace);
            votable.getParams().addAll(getParams(params, namespace));

            // FIELD elements.
            List<Element> fields = table.getChildren("FIELD", namespace);
            votable.getColumns().addAll(getFields(fields, namespace));

            // DATA element.
            Element data = table.getChild("DATA", namespace);
            if (data != null) {
                // TABLEDATA element.
                Element tableData = data.getChild("TABLEDATA", namespace);
                votable.setTableData(getTableData(tableData, namespace, votable.getColumns()));
            }
        }
    }
    return votable;
}

From source file:ca.nrc.cadc.dali.tables.votable.VOTableWriter.java

License:Open Source License

/**
 * Write the VOTable to the specified Writer, only writing maxrec rows.
 * If the VOTable contains more than maxrec rows, appends an INFO element with
 * name="QUERY_STATUS" value="OVERFLOW" to the VOTable.
 *
 * @param votable VOTable object to write.
 * @param writer Writer to write to.//from  w  w w  .  j a  va2s.  c  om
 * @param maxRec maximum number of rows to write.
 * @throws IOException if problem writing to the writer.
 */
public void write(VOTable votable, Writer writer, Long maxrec) throws IOException {
    log.debug("write, maxrec=" + maxrec);

    // VOTable document and root element.
    Document document = createDocument();
    Element root = document.getRootElement();
    Namespace namespace = root.getNamespace();

    // Create the RESOURCE element and add to the VOTABLE element.
    Element resource = new Element("RESOURCE", namespace);
    if (votable.getResourceName() != null) {
        resource.setAttribute("name", votable.getResourceName());
    }
    root.addContent(resource);

    // Create the INFO element and add to the RESOURCE element.
    for (Info in : votable.getInfos()) {
        Element info = new Element("INFO", namespace);
        info.setAttribute("name", in.getName());
        info.setAttribute("value", in.getValue());
        resource.addContent(info);
    }

    // Create the TABLE element and add to the RESOURCE element.
    Element table = new Element("TABLE", namespace);
    resource.addContent(table);

    // Add the metadata elements.
    for (TableParam param : votable.getParams()) {
        table.addContent(new ParamElement(param, namespace));
    }
    for (TableField field : votable.getColumns()) {
        table.addContent(new FieldElement(field, namespace));
    }

    // Create the DATA and TABLEDATA elements.
    Element data = new Element("DATA", namespace);
    table.addContent(data);

    // Add content.
    try {
        Iterator<List<Object>> it = votable.getTableData().iterator();

        TabledataContentConverter elementConverter = new TabledataContentConverter(namespace);
        TabledataMaxIterations maxIterations = new TabledataMaxIterations(maxrec, resource, namespace);

        IterableContent<Element, List<Object>> tabledata = new IterableContent<Element, List<Object>>(
                "TABLEDATA", namespace, it, elementConverter, maxIterations);

        data.addContent(tabledata);
    } catch (Throwable t) {
        log.debug("failure while iterating", t);
        Element info = new Element("INFO", namespace);
        info.setAttribute("name", "QUERY_STATUS");
        info.setAttribute("value", "ERROR");
        info.setText(t.toString());
        resource.addContent(info);
    }

    // Write out the VOTABLE.
    XMLOutputter outputter = new XMLOutputter();
    outputter.setFormat(org.jdom2.output.Format.getPrettyFormat());
    outputter.output(document, writer);
}

From source file:ca.nrc.cadc.dali.tables.votable.VOTableWriter.java

License:Open Source License

/**
 * Write the Throwable to a VOTable, creating an INFO element with
 * name="QUERY_STATUS" value="ERROR" and setting the stacktrace as
 * the INFO text./*from  w w  w  .j ava 2 s. c  om*/
 *
 * @param thrown Throwable to write.
 * @param output OutputStream to write to.
 * @throws IOException if problem writing to the stream.
 */
public void write(Throwable thrown, OutputStream output) throws IOException {
    Document document = createDocument();
    Element root = document.getRootElement();
    Namespace namespace = root.getNamespace();

    // Create the RESOURCE element and add to the VOTABLE element.
    Element resource = new Element("RESOURCE", namespace);
    resource.setAttribute("type", "results");
    root.addContent(resource);

    // Create the INFO element and add to the RESOURCE element.
    Element info = new Element("INFO", namespace);
    info.setAttribute("name", "QUERY_STATUS");
    info.setAttribute("value", "ERROR");
    info.setText(getThrownExceptions(thrown));
    resource.addContent(info);

    // Write out the VOTABLE.
    XMLOutputter outputter = new XMLOutputter();
    outputter.setFormat(org.jdom2.output.Format.getPrettyFormat());
    outputter.output(document, output);
}

From source file:ca.nrc.cadc.vos.NodeReader.java

License:Open Source License

/**
 *  Construct a Node from a Reader./*from w ww  .  ja  v a  2s.  co  m*/
 *
 * @param reader Reader.
 * @return Node Node.
 * @throws NodeParsingException if there is an error parsing the XML.
 */
public Node read(Reader reader) throws NodeParsingException, IOException {
    if (reader == null)
        throw new IllegalArgumentException("reader must not be null");

    // Create a JDOM Document from the XML
    Document document;
    try {
        // TODO: investigate creating a SAXBuilder once and re-using it
        // as long as we can detect concurrent access (a la java collections)
        document = XmlUtil.validateXml(reader, schemaMap);
    } catch (JDOMException jde) {
        String error = "XML failed schema validation: " + jde.getMessage();
        throw new NodeParsingException(error, jde);
    }

    // Root element and namespace of the Document
    Element root = document.getRootElement();
    Namespace namespace = root.getNamespace();
    log.debug("node namespace uri: " + namespace.getURI());
    log.debug("node namespace prefix: " + namespace.getPrefix());

    /* Node base elements */
    // uri attribute of the node element
    String uri = root.getAttributeValue("uri");
    if (uri == null) {
        String error = "uri attribute not found in root element";
        throw new NodeParsingException(error);
    }
    log.debug("node uri: " + uri);

    // Get the xsi:type attribute which defines the Node class
    String xsiType = root.getAttributeValue("type", xsiNamespace);
    if (xsiType == null) {
        String error = "xsi:type attribute not found in node element " + uri;
        throw new NodeParsingException(error);
    }

    // Split the type attribute into namespace and Node type
    String[] types = xsiType.split(":");
    String type = types[1];
    log.debug("node type: " + type);

    try {
        if (type.equals(ContainerNode.class.getSimpleName()))
            return buildContainerNode(root, namespace, uri);
        else if (type.equals(DataNode.class.getSimpleName()))
            return buildDataNode(root, namespace, uri);
        else if (type.equals(UnstructuredDataNode.class.getSimpleName()))
            return buildUnstructuredDataNode(root, namespace, uri);
        else if (type.equals(LinkNode.class.getSimpleName()))
            return buildLinkNode(root, namespace, uri);
        else if (type.equals(StructuredDataNode.class.getSimpleName()))
            return buildStructuredDataNode(root, namespace, uri);
        else
            throw new NodeParsingException("unsupported node type " + type);
    } catch (URISyntaxException e) {
        throw new NodeParsingException("invalid uri in xml: " + e.getMessage());
    }
}

From source file:ca.nrc.cadc.xml.JsonInputter.java

License:Open Source License

private void processJSONObject(JSONObject jsonObject, Element element, List<Namespace> namespaces)
        throws JSONException {
    List<String> keys = Arrays.asList(JSONObject.getNames(jsonObject));
    Namespace namespace = getNamespace(namespaces, jsonObject, keys);
    if (namespace == null) {
        namespace = element.getNamespace();
    }/*www  .  j av a2 s.c  o  m*/

    for (String key : keys) {
        if (jsonObject.isNull(key)) {
            continue;
        }

        // attribute
        if (key.startsWith("@")) {
            Object value = jsonObject.get(key);
            element.setAttribute(new Attribute(key.substring(1), getStringValue(value)));
            continue;
        }

        // text content
        Object value = jsonObject.get(key);
        if (key.equals("$")) {
            element.setText(getStringValue(value));
            continue;
        }

        Element child = new Element(key, namespace);
        if (listElementMap.containsKey(key)) {
            final String childKey = listElementMap.get(key);
            final Object childObject = ((JSONObject) value).get("$");
            Element grandChild = new Element(childKey, namespace);

            if (childObject instanceof JSONArray) {
                processJSONArray(key, (JSONArray) childObject, child, namespace, namespaces);
            } else if (childObject instanceof JSONObject) {
                processJSONObject((JSONObject) childObject, grandChild, namespaces);
                child.addContent(grandChild);
            }
        } else if (value instanceof JSONObject) {
            processJSONObject((JSONObject) value, child, namespaces);
        }

        element.addContent(child);
    }
}

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

License:Open Source License

private boolean prepareValidationData(ValidationContext validationContext)
        throws JDOMException, IOException, Exception {
    int onWork = 41;
    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  w  w w . j  a  v a  2 s  . c  o m*/
            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 (onWork == 41) {
            onWork = 2;
            System.out.print("E-   ");
            System.out.print("\r");
        } else if (onWork == 11) {
            onWork = 12;
            System.out.print("E\\   ");
            System.out.print("\r");
        } else if (onWork == 21) {
            onWork = 22;
            System.out.print("E|   ");
            System.out.print("\r");
        } else if (onWork == 31) {
            onWork = 32;
            System.out.print("E/   ");
            System.out.print("\r");
        } else {
            onWork = onWork + 1;
        }
    }
    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 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();// ww  w .  j  av a  2  s .  c  o 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;
}