Neuen XML-Knoten in Datei speichern
Ich versuche zu rettennodeList
Knoten, der @ enthäXML
als neue Datei, hier ist die Knotenliste, die ein neues @ erhäXML
doc und aufgeteilt auf kleinerXMLs
:
public void split(Document inDocument) throws ParserConfigurationException,
SAXException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
SaveXML savePerJob = new SaveXML();
// Load the input XML document, parse it and return an instance of the
// Document class.
Document document = inDocument;
//all elements
//jobs
NodeList nodes = document.getDocumentElement().getChildNodes();
NodeList jobs = nodes.item(7).getChildNodes();
for(int j =0; j<jobs.getLength(); j++){
Node itm = jobs.item(j);
String itmName = itm.getFirstChild().getNodeName();
String itmID = itm.getFirstChild().getTextContent();
System.out.println("name: " + itmName + " value: " + itmID);
//here I want to save the node as a new .xml file
}
}
die Ausgabe ist eine lange Liste wie:
name: id value: 9496425
Nun möchte ich den Knoten speichernitm
as new new.xml
file und ich habe die Funktion, die den Knoten zurückgibt, nicht gefunden. Vielen Dank