我对XML中的输出有疑问。我有第1和第2号扫描仪...我想用表格准备xml输出文件(例如第1号是10号,第2号是15号)
<line>
<Point>
<X>10</X>
</Point>
</line>
<line>
<Point>
<X>11</X>
</Point>
</line>
<line>
<Point>
<X>12</X>
</Point>
</line>
等......直到第二个数字
try{
XMLOutputFactory f = XMLOutputFactory.newInstance();
XMLStreamWriter w = f.createXMLStreamWriter(new FileOutputStream(output));
w.writeComment("XMLOutput");
w.writeStartElement("line");
w.writeStartElement("Point");
w.writeStartElement("X");
String pointX0 = String.valueOf(a);
w.writeCharacters(pointX0);
w.writeEndElement();
w.writeEndElement();
}
w.writeEndElement();
w.writeEndDocument();
w.close();
} catch (XMLStreamException ex) {
Logger.getLogger(Output.class.getName()).log(Level.SEVERE, null, ex);
}
}
Iam在for for循环中苦苦挣扎,但我不知道我该把它放在哪里......