Entendendo o JDOM

3 respostas
Growth

Olá.

Estou pesquisando sobre o JDOM e fazendo alguns testes.
Porém não consegui entender, baseado no código abaixo, em qual diretório local é criado o documento xml:

public static void CriaXML ()
      {
//      Create the root element
        Element carElement = new Element("car");
//        create the document
        Document myDocument = new Document(carElement);
//        add an attribute to the root element
        carElement.setAttribute(new Attribute("vin", "123fhg5869705iop90"));

//        add a comment
        carElement.addContent(new Comment("Description of a car"));

//        add some child elements
        Element make = new Element("make");
        make.addContent("Toyota");
        carElement.addContent(make);

//        add some more elements
        carElement.addContent(new Element("model").addContent("Celica"));
        carElement.addContent(new Element("year").addContent("1997"));
        carElement.addContent(new Element("color").addContent("green"));
        carElement.addContent(new Element("license").addContent("1ABC234").setAttribute("state", "CA"));
        }

3 Respostas

Luca

Olá

Por favor não repita a mesma pergunta várias vezes.

Obrigado

[]s
Luca

aborges

Nao esta gravando em diretorio nenhum… Para gravar seu XML utilize o http://www.jdom.org/docs/apidocs/org/jdom/output/XMLOutputter.html

Growth

Valeu. Fiz o teste e funcionou, porém está gravando tudo na mesma linha.
Como faço para indentar?

Criado 30 de outubro de 2006
Ultima resposta 30 de out. de 2006
Respostas 3
Participantes 3