Ola amigos,
Estou tentando gerar um XML utilizando JDOM.
peguei alguns exemplos, mas não consigo fazer funcionar.
segue uma parte do código exemplo:
Element carElement = new Element("car");
Document myDocument = new Document(carElement);
carElement.addAttribute(new Attribute("vin", "123fhg5869705iop90"));
Element make = new Element("make");
make.addContent("Toyota");
carElement.addContent(make);
O Eclipse marca como erro o “.addAttribute” da linha: carElement.addAttribute();new Attribute(“vin”, “123fhg5869705iop90”)
A descrição do erro é:
Multiple markers at this line
- Syntaxe error on token, misplaced construct(s)
- Syntaxe error on token “addAttribute”, = expected after this token
e també, marcar como erro o “.” e o "“Toyota” da linha: make.addContent(“Toyota”);
A descrição do erro é:
Multiple markers at this line
- Syntaxe error on token, misplaced construct(s)
- Syntaxe error on token ““Toyota””, delete this token
Estou utilizando os seguites import:
import org.jdom.Attribute;
import org.jdom.Comment;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
- Acho que estou cometento algum erro básico, mas como sou iniciante no java, não consegui identificar o q é.
Grato pela ajuda
Marcos Batalha