Example usage for org.jdom2 Attribute Attribute

List of usage examples for org.jdom2 Attribute Attribute

Introduction

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

Prototype

public Attribute(final String name, final String value) 

Source Link

Document

This will create a new Attribute with the specified (local) name and value, and does not place the attribute in a Namespace .

Usage

From source file:xmlproject.TraitementNote.java

License:Open Source License

public void addNote(String xmlNote, String interactifNote, String cooperatifNote, String embarqueNote,
        String jmxNote, String testNote, String codeEtudiant, String moyenne) {
    this.racine.addContent(etudiant);

    Attribute codeEtudiantId = new Attribute("id", codeEtudiant);
    Attribute xmlNoteId = new Attribute("id", "x1");
    Attribute interactifNoteId = new Attribute("id", "i1");
    Attribute cooperatifNoteId = new Attribute("id", "c1");
    Attribute embarqueNoteId = new Attribute("id", "e1");
    Attribute jmxNoteId = new Attribute("id", "j1");
    Attribute testNoteId = new Attribute("id", "t1");

    //creation des elements avec leurs contenu
    this.codeEtudiant = new Element("code-etudiant");
    this.codeEtudiant.setText(codeEtudiant);
    this.codeEtudiant.setAttribute(codeEtudiantId);

    this.xmlNote = new Element("xml-note");
    this.xmlNote.setText(xmlNote);
    this.xmlNote.setAttribute(xmlNoteId);

    this.interactifNote = new Element("interactif-note");
    this.interactifNote.setText(interactifNote);
    this.interactifNote.setAttribute(interactifNoteId);

    this.cooperatifNote = new Element("cooperatif-note");
    this.cooperatifNote.setText(cooperatifNote);
    this.cooperatifNote.setAttribute(cooperatifNoteId);

    this.embarqueNote = new Element("embraque-note");
    this.embarqueNote.setText(embarqueNote);
    this.embarqueNote.setAttribute(embarqueNoteId);

    this.jmxNote = new Element("jmx-note");
    this.jmxNote.setText(jmxNote);
    this.jmxNote.setAttribute(jmxNoteId);

    this.testNote = new Element("test-note");
    this.testNote.setText(testNote);
    this.testNote.setAttribute(testNoteId);

    this.moyenne = new Element("moyenne");
    this.moyenne.setText(moyenne);

    this.etudiant.addContent(this.moyenne).clone();
    this.etudiant.addContent(this.codeEtudiant).clone();
    this.etudiant.addContent(this.xmlNote).clone();
    this.etudiant.addContent(this.interactifNote).clone();
    this.etudiant.addContent(this.cooperatifNote).clone();
    this.etudiant.addContent(this.embarqueNote).clone();
    this.etudiant.addContent(this.testNote).clone();
    this.etudiant.addContent(this.jmxNote).clone();

}