Example usage for org.jdom2 Document Document

List of usage examples for org.jdom2 Document Document

Introduction

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

Prototype

public Document(List<? extends Content> content) 

Source Link

Document

This will create a new Document, with the supplied list of content, and a DocType declaration only if the content contains a DocType instance.

Usage

From source file:org.openkennel.model.filemngr.XMLFileHandler.java

License:Open Source License

/**
 * Creates a new memory image for a XML file, without data.
 * Root element with name 'root' is set.
 *//*w w w .  j  av  a 2s. c o m*/
public void createXMLDocument(String root) {
    if (!xmlExists()) {
        xmlRoot = new Element(root);
        xmlFile = new Document(xmlRoot);
    }
}

From source file:org.openmrs.module.dataaggregation.web.controller.DataAggregationManageController.java

License:Open Source License

private String convertToXML(String csvString) {
    String[] rows = csvString.split("\n");
    Element table = new Element("table");
    Document doc = new Document(table);
    int i = 0;/*w w w . j av  a 2 s  .com*/
    while (i < rows.length) {
        Element row = new Element("row" + i);
        String[] cols = rows[i].split(":");
        int j = 0;
        for (String rowS : cols) {
            row.setAttribute(new Attribute("col" + j, rowS));
            j++;
        }

        doc.getRootElement().addContent(row);

        i++;
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    xmlOutput.setFormat(Format.getPrettyFormat());
    return xmlOutput.outputString(doc);
}

From source file:org.plasma.xml.uml.DefaultUMLModelAssembler.java

License:Open Source License

private Document buildDocumentModel(Model model, String destNamespaceURI, String destNamespacePrefix) {
    this.xmiElem = new Element("XMI");
    this.xmiElem.setNamespace(xmiNs);
    Document document = new Document(this.xmiElem);
    this.xmiElem.setAttribute(new Attribute("version", this.xmiVersion, this.xmiNs)); // FIXME - use FUML config for this, i.e which version?
    this.xmiElem.addNamespaceDeclaration(umlNs);
    this.xmiElem.addNamespaceDeclaration(xmiNs);
    this.xmiElem.addNamespaceDeclaration(plasmaNs);
    if (this.platformNs != null)
        this.xmiElem.addNamespaceDeclaration(platformNs);
    if (this.xsiNs != null) {
        this.xmiElem.addNamespaceDeclaration(xsiNs);
        this.xmiElem.setAttribute(new Attribute("schemaLocation", this.xsiSchemaLocation, this.xsiNs));
    }/* w  w w. j a  v  a2s.c  o  m*/

    if (this.derivePackageNamesFromURIs)
        this.modelElem = this.buildModelFromURITokens(model);
    else
        this.modelElem = this.buildModelFromPackageNames(model);
    Element profileApplicationElem = buildProfileApplication();
    if (profileApplicationElem != null)
        this.modelElem.addContent(profileApplicationElem);

    collectPackages(model);
    collectClasses(model);
    collectEnumerations(model);

    for (Class clss : this.classMap.values()) {
        Package pkg = this.classPackageMap.get(clss);
        Element clssElem = buildClass(clss);
        elementMap.put(clss.getId(), clssElem);
        // build properties w/o any associations
        for (Property property : clss.getProperties()) {

            Element ownedAttribute = buildProperty(pkg, clss, property, clssElem);
            elementMap.put(property.getId(), ownedAttribute);
        }
    }

    // create associations
    for (Class clss : this.classMap.values()) {
        for (Property prop : clss.getProperties()) {

            if (prop.getType() instanceof DataTypeRef)
                continue;

            if (associationElementMap.get(prop.getId()) != null)
                continue; // we created it

            String associationUUID = UUID.randomUUID().toString();

            // link assoc to both properties
            Element leftOwnedAttribute = elementMap.get(prop.getId());
            leftOwnedAttribute.setAttribute(new Attribute("association", associationUUID));

            Property targetProp = getOppositeProperty(clss, prop);
            if (targetProp != null) {
                Element rightOwnedAttribute = elementMap.get(targetProp.getId());
                rightOwnedAttribute.setAttribute(new Attribute("association", associationUUID));

                Element association = buildAssociation(prop, targetProp, this.modelElem, associationUUID);

                // map it to both props so we can know not to create it again
                associationElementMap.put(prop.getId(), association);
                associationElementMap.put(targetProp.getId(), association);
            } else {
                Class targetClass = getOppositeClass(clss, prop);
                Element association = buildAssociation(prop, targetClass, this.modelElem, associationUUID);

                // map it to both props so we can know not to create it again
                associationElementMap.put(prop.getId(), association);

            }
        }
    }

    return document;
}

From source file:org.rascalmpl.library.lang.xml.DOM.java

License:Open Source License

private Document nodeToDocument(IConstructor node) {
    if (node.getType() != Factory.Node) {
        wellformednessError();/*w w  w.j a v  a  2 s  .c o m*/
    }
    if (node.getConstructorType() != Factory.Node_document
            && node.getConstructorType() != Factory.Node_element) {
        wellformednessError();
    }

    if (node.getConstructorType() == Factory.Node_document) {
        return new Document(nodeToElement((IConstructor) node.get(0)));
    }
    return new Document(nodeToElement(node));
}

From source file:org.shaman.rpg.editor.project.elements.JdomElements.java

private JdomGroup newDoc() {
    //create new file
    org.jdom2.Element e = new org.jdom2.Element(ROOT_NAME);
    e.setNamespace(NAMESPACE);//  w  w  w .ja v a2  s. c om
    //e.setAttribute("xmlns", ROOT_NAMESPACE);
    doc = new Document(e);
    JdomGroup r = new JdomGroup(null, this, e, 0);
    return r;
}

From source file:org.shaman.rpg.editor.project.impl.ModuleBuildFileGenerator.java

private Document generateDoc() {
    Element root = new Element("project");
    root.setAttribute("name", "build-impl-engine");
    root.setAttribute("basedir", "..");
    root.addContent(new Comment("these ant tasks are called from the modules"));

    //add properties
    addProperties(root);//from  w w  w . ja v a  2 s .  c om
    root.addContent("\n");

    //add custom contents
    root.addContent(customContents);
    root.addContent("\n");

    //add main target
    addMainTarget(root);
    root.addContent("\n");

    //add property init target
    addPropertyInitTarget(root);
    root.addContent("\n");

    //add ant-contrib initializing target
    addTaskefTarget(root);
    root.addContent("\n");

    //add groovy-compile target
    addGroovyCTarget(root);
    root.addContent("\n");

    //add targets
    addTargets(root);

    //create document
    return new Document(root);
}

From source file:org.sleuthkit.autopsy.report.ReportKML.java

License:Open Source License

/**
 * Generates a body file format report for use with the MAC time tool.
 *
 * @param path path to save the report/* www.  j a v  a 2  s . co  m*/
 * @param progressPanel panel to update the report's progress
 */
@Override
public void generateReport(String path, ReportProgressPanel progressPanel) {

    // Start the progress bar and setup the report
    progressPanel.setIndeterminate(false);
    progressPanel.start();
    progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.querying"));
    reportPath = path + "ReportKML.kml"; //NON-NLS
    String reportPath2 = path + "ReportKML.txt"; //NON-NLS
    currentCase = Case.getCurrentCase();
    skCase = currentCase.getSleuthkitCase();

    progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading"));
    // Check if ingest has finished
    String ingestwarning = "";
    if (IngestManager.getInstance().isIngestRunning()) {
        ingestwarning = NbBundle.getMessage(this.getClass(), "ReportBodyFile.ingestWarning.text");
    }
    progressPanel.setMaximumProgress(5);
    progressPanel.increment();

    // @@@ BC: I don't get why we do this in two passes.  
    // Why not just print the coordinates as we find them and make some utility methods to do the printing?
    // Should pull out time values for all of these points and store in TimeSpan element
    try {

        BufferedWriter out = null;
        try {
            out = new BufferedWriter(new FileWriter(reportPath2));

            double lat = 0; // temp latitude
            double lon = 0; //temp longitude
            AbstractFile aFile;
            String geoPath = ""; // will hold values of images to put in kml
            String imageName = "";

            File f;
            for (BlackboardArtifact artifact : skCase
                    .getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF)) {
                lat = 0;
                lon = 0;
                geoPath = "";
                String extractedToPath;
                for (BlackboardAttribute attribute : artifact.getAttributes()) {
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE
                            .getTypeID()) //latitude
                    {

                        lat = attribute.getValueDouble();
                    }
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE
                            .getTypeID()) //longitude
                    {
                        lon = attribute.getValueDouble();
                    }
                }
                if (lon != 0 && lat != 0) {
                    aFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID());

                    extractedToPath = reportPath + aFile.getName();
                    geoPath = extractedToPath;
                    f = new File(extractedToPath);
                    f.createNewFile();
                    copyFileUsingStream(aFile, f);
                    imageName = aFile.getName();
                    out.write(String.valueOf(lat));
                    out.write(";");
                    out.write(String.valueOf(lon));
                    out.write(";");
                    out.write(String.valueOf(geoPath));
                    out.write(";");
                    out.write(String.valueOf(imageName));
                    out.write("\n");
                    // lat lon path name
                }
            }

            for (BlackboardArtifact artifact : skCase
                    .getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)) {
                lat = 0;
                lon = 0;
                for (BlackboardAttribute attribute : artifact.getAttributes()) {
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE
                            .getTypeID()) //latitude
                    {
                        lat = attribute.getValueDouble();
                    }
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE
                            .getTypeID()) //longitude
                    {
                        lon = attribute.getValueDouble();
                    }
                }
                if (lon != 0 && lat != 0) {
                    out.write(lat + ";" + lon + "\n");
                }
            }

            for (BlackboardArtifact artifact : skCase
                    .getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE)) {
                lat = 0;
                lon = 0;
                double destlat = 0;
                double destlon = 0;
                String name = "";
                String location = "";
                for (BlackboardAttribute attribute : artifact.getAttributes()) {
                    if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START
                                    .getTypeID()) //latitude
                    {
                        lat = attribute.getValueDouble();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END
                                    .getTypeID()) //longitude
                    {
                        destlat = attribute.getValueDouble();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START
                                    .getTypeID()) //longitude
                    {
                        lon = attribute.getValueDouble();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END
                                    .getTypeID()) //longitude 
                    {
                        destlon = attribute.getValueDouble();
                    } else if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME
                            .getTypeID()) //longitude 
                    {
                        name = attribute.getValueString();
                    } else if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION
                            .getTypeID()) //longitude 
                    {
                        location = attribute.getValueString();
                    }
                }

                // @@@ Should do something more fancy with these in KML and store them as a single point.
                String display = name;
                if (display.isEmpty())
                    display = location;

                if (lon != 0 && lat != 0) {
                    out.write(NbBundle.getMessage(this.getClass(), "ReportKML.latLongStartPoint", lat, lon,
                            display));
                }
                if (destlat != 0 && destlon != 0) {
                    out.write(NbBundle.getMessage(this.getClass(), "ReportKML.latLongEndPoint", destlat,
                            destlon, display));
                }
            }

            out.flush();
            out.close();

            progressPanel.increment();
            /*
             * Step 1: generate XML stub
             */
            Namespace ns = Namespace.getNamespace("", "http://earth.google.com/kml/2.2"); //NON-NLS
            // kml
            Element kml = new Element("kml", ns); //NON-NLS
            Document kmlDocument = new Document(kml);

            // Document
            Element document = new Element("Document", ns); //NON-NLS
            kml.addContent(document);

            // name
            Element name = new Element("name", ns); //NON-NLS
            name.setText("Java Generated KML Document"); //NON-NLS
            document.addContent(name);

            /*
             * Step 2: add in Style elements
             */

            // Style
            Element style = new Element("Style", ns); //NON-NLS
            style.setAttribute("id", "redIcon"); //NON-NLS
            document.addContent(style);

            // IconStyle
            Element iconStyle = new Element("IconStyle", ns); //NON-NLS
            style.addContent(iconStyle);

            // color
            Element color = new Element("color", ns); //NON-NLS
            color.setText("990000ff"); //NON-NLS
            iconStyle.addContent(color);

            // Icon
            Element icon = new Element("Icon", ns); //NON-NLS
            iconStyle.addContent(icon);

            // href
            Element href = new Element("href", ns); //NON-NLS
            href.setText("http://www.cs.mun.ca/~hoeber/teaching/cs4767/notes/02.1-kml/circle.png"); //NON-NLS
            icon.addContent(href);
            progressPanel.increment();
            /*
             * Step 3: read data from source location and
             * add in a Placemark for each data element
             */

            File file = new File(reportPath2);
            BufferedReader reader;

            reader = new BufferedReader(new FileReader(file));

            String line = reader.readLine();
            while (line != null) {
                String[] lineParts = line.split(";");
                if (lineParts.length > 1) {
                    String coordinates = lineParts[1].trim() + "," + lineParts[0].trim(); //lat,lon
                    // Placemark
                    Element placemark = new Element("Placemark", ns); //NON-NLS
                    document.addContent(placemark);

                    if (lineParts.length == 4) {
                        // name
                        Element pmName = new Element("name", ns); //NON-NLS
                        pmName.setText(lineParts[3].trim());
                        placemark.addContent(pmName);

                        String savedPath = lineParts[2].trim();
                        if (savedPath.isEmpty() == false) {
                            // Path
                            Element pmPath = new Element("Path", ns); //NON-NLS
                            pmPath.setText(savedPath);
                            placemark.addContent(pmPath);

                            // description
                            Element pmDescription = new Element("description", ns); //NON-NLS
                            String xml = "<![CDATA[  \n" + " <img src='file:///" + savedPath
                                    + "' width='400' /><br/&gt;  \n"; //NON-NLS
                            StringEscapeUtils.unescapeXml(xml);
                            pmDescription.setText(xml);
                            placemark.addContent(pmDescription);
                        }
                    }

                    // styleUrl
                    Element pmStyleUrl = new Element("styleUrl", ns); //NON-NLS
                    pmStyleUrl.setText("#redIcon"); //NON-NLS
                    placemark.addContent(pmStyleUrl);

                    // Point
                    Element pmPoint = new Element("Point", ns); //NON-NLS
                    placemark.addContent(pmPoint);

                    // coordinates
                    Element pmCoordinates = new Element("coordinates", ns); //NON-NLS

                    pmCoordinates.setText(coordinates);
                    pmPoint.addContent(pmCoordinates);

                }

                // read the next line
                line = reader.readLine();
            }
            progressPanel.increment();
            /*
             * Step 4: write the XML file
             */
            try {
                XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
                FileOutputStream writer = new FileOutputStream(reportPath);
                outputter.output(kmlDocument, writer);
                writer.close();
                Case.getCurrentCase().addReport(reportPath,
                        NbBundle.getMessage(this.getClass(), "ReportKML.genReport.srcModuleName.text"), "");
            } catch (IOException ex) {
                logger.log(Level.WARNING, "Could not write the KML file.", ex); //NON-NLS
            } catch (TskCoreException ex) {
                String errorMessage = String.format("Error adding %s to case as a report", reportPath); //NON-NLS
                logger.log(Level.SEVERE, errorMessage, ex);
            }
        } catch (IOException ex) {
            logger.log(Level.WARNING, "Could not write the KML report.", ex); //NON-NLS
        }
        progressPanel.complete();
    } catch (TskCoreException ex) {
        logger.log(Level.WARNING, "Failed to get the unique path.", ex); //NON-NLS
    }
    progressPanel.increment();
    progressPanel.complete();
}

From source file:org.sleuthkit.openmobileforensics.android.KMLFileCreator.java

License:Open Source License

public void CreateKML() {

    reportPath = Case.getCurrentCase().getTempDirectory() + "ReportKML.kml"; //NON-NLS
    String reportPath2 = Case.getCurrentCase().getTempDirectory() + "ReportKML.txt"; //NON-NLS
    currentCase = Case.getCurrentCase();
    skCase = currentCase.getSleuthkitCase();

    try {/*from ww w  . j a  v a2 s .c  o m*/

        BufferedWriter out = null;
        try {
            out = new BufferedWriter(new FileWriter(reportPath2));

            String lat = ""; // temp latitude
            String lon = ""; //temp longitude
            String destlon = "";
            String destlat = "";
            for (BlackboardArtifact artifact : skCase
                    .getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)) {
                lat = "";
                lon = "";
                for (BlackboardAttribute attribute : artifact.getAttributes()) {
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE
                            .getTypeID()) //latitude
                    {
                        lat = attribute.getValueString();
                    }
                    if (attribute.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE
                            .getTypeID()) //longitude
                    {
                        lon = attribute.getValueString();
                    }
                }
                if (!lon.isEmpty() && !lat.isEmpty()) {
                    out.write(lat + ";" + lon + "\n");

                }
            }
            for (BlackboardArtifact artifact : skCase
                    .getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE)) {
                lat = "";
                lon = "";
                for (BlackboardAttribute attribute : artifact.getAttributes()) {
                    if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START
                                    .getTypeID()) //latitude
                    {
                        lat = attribute.getValueString();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END
                                    .getTypeID()) //longitude
                    {
                        destlat = attribute.getValueString();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START
                                    .getTypeID()) //longitude
                    {
                        lon = attribute.getValueString();
                    } else if (attribute
                            .getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END
                                    .getTypeID()) //longitude
                    {
                        destlon = attribute.getValueString();
                    }

                }
                if (!lon.isEmpty() && !lat.isEmpty()) {
                    out.write(lat + ";" + lon + "\n");
                }
                if (!destlon.isEmpty() && !destlat.isEmpty()) {
                    out.write(destlat + ";" + destlon + "\n");

                }
            }
            out.flush();
            out.close();
            /*
             * Step 1: generate XML stub
             */
            Namespace ns = Namespace.getNamespace("", "http://earth.google.com/kml/2.2"); //NON-NLS
            // kml
            Element kml = new Element("kml", ns); //NON-NLS
            Document kmlDocument = new Document(kml);

            // Document
            Element document = new Element("Document", ns); //NON-NLS
            kml.addContent(document);

            // name
            Element name = new Element("name", ns); //NON-NLS
            name.setText("Java Generated KML Document"); //NON-NLS
            document.addContent(name);

            /*
             * Step 2: add in Style elements
             */

            // Style
            Element style = new Element("Style", ns); //NON-NLS
            style.setAttribute("id", "redIcon"); //NON-NLS
            document.addContent(style);

            // IconStyle
            Element iconStyle = new Element("IconStyle", ns); //NON-NLS
            style.addContent(iconStyle);

            // color
            Element color = new Element("color", ns); //NON-NLS
            color.setText("990000ff"); //NON-NLS
            iconStyle.addContent(color);

            // Icon
            Element icon = new Element("Icon", ns); //NON-NLS
            iconStyle.addContent(icon);

            // href
            Element href = new Element("href", ns); //NON-NLS
            href.setText("http://www.cs.mun.ca/~hoeber/teaching/cs4767/notes/02.1-kml/circle.png"); //NON-NLS
            icon.addContent(href);
            /*
             * Step 3: read data from source location and
             * add in a Placemark for each data element
             */

            File file = new File(reportPath2);
            BufferedReader reader;

            reader = new BufferedReader(new FileReader(file));

            String line = reader.readLine();
            while (line != null) {
                String[] lineParts = line.split(";");
                if (lineParts.length == 2) {
                    String coordinates = lineParts[1].trim() + "," + lineParts[0].trim(); //lat,lon
                    // Placemark
                    Element placemark = new Element("Placemark", ns); //NON-NLS
                    document.addContent(placemark);

                    // styleUrl
                    Element pmStyleUrl = new Element("styleUrl", ns); //NON-NLS
                    pmStyleUrl.setText("#redIcon"); //NON-NLS
                    placemark.addContent(pmStyleUrl);

                    // Point
                    Element pmPoint = new Element("Point", ns); //NON-NLS
                    placemark.addContent(pmPoint);

                    // coordinates
                    Element pmCoordinates = new Element("coordinates", ns); //NON-NLS

                    pmCoordinates.setText(coordinates);
                    pmPoint.addContent(pmCoordinates);

                }
                // read the next line
                line = reader.readLine();
            }
            /*
             * Step 4: write the XML file
             */
            try {
                XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
                FileOutputStream writer = new FileOutputStream(reportPath);
                outputter.output(kmlDocument, writer);
                writer.close();
            } catch (IOException ex) {
            }
        } catch (IOException ex) {
        }
    } catch (TskCoreException ex) {
    }

}

From source file:org.t3.metamediamanager.FieldsConfig.java

License:Apache License

public void save() {
    Element root = new Element("fields");
    Document doc = new Document(root);

    for (Entry<String, String> fieldEntry : _fieldsAssociation.entrySet()) {
        Element elemField = new Element("field");
        elemField.setAttribute("name", fieldEntry.getKey());
        elemField.setAttribute("markup", fieldEntry.getValue());
        root.addContent(elemField);// w w w .jav a2 s .c om
    }

    //Save
    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
    try {
        out.output(doc, new FileOutputStream(_configFile));
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.t3.metamediamanager.M3Config.java

License:Apache License

/**
 * Saves all parameters in "config.xml" file located in the user directory
 *//*from ww w  .j  a  v a2  s .  co m*/
public void save() {
    try {
        Element root = new Element("config");
        Document doc = new Document(root);
        for (Entry<String, String> entry : _params.entrySet()) {
            Element p = new Element("param");
            p.setAttribute("name", entry.getKey());
            p.setAttribute("value", entry.getValue());
            root.addContent(p);
        }

        //Film directories
        for (String dir : _filmsDirectories) {
            Element d = new Element("dir");
            d.setAttribute("type", "films");
            d.setAttribute("url", dir);
            root.addContent(d);
        }

        //Series directories
        for (String dir : _seriesDirectories) {
            Element d = new Element("dir");
            d.setAttribute("type", "series");
            d.setAttribute("url", dir);
            root.addContent(d);
        }

        //Enabled savers
        for (String s : _enabledSavers) {
            Element d = new Element("enabledSaver");
            d.setText(s);
            root.addContent(d);
        }

        //Enabled providers
        for (String s : _enabledProviders) {
            Element d = new Element("enabledProvider");
            d.setText(s);
            root.addContent(d);
        }

        //Save
        XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
        sortie.output(doc, new FileOutputStream(_fileConfig));
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } finally {

    }
}