/** * Write the instance of IndexOfModelMappings back to the corresponding file (Used for * persistence) */ public static synchronized void writeIndexBackToFile() { // Write file from the Vector File outFile = new File(Model3dIndex.getIndexPath() + "modelIndex.xml"); try { outFile .createNewFile(); // will create it if it does not exist, otherwise will return false (we // don't care) FileWriter tmpoutWriter = new FileWriter(outFile); WstxOutputFactory fout = new WstxOutputFactory(); fout.configureForXmlConformance(); SMOutputDocument doc = null; SMOutputElement outputRootEl = null; SMOutputElement outputRootEl2 = null; // output XMLStreamWriter2 sw = (XMLStreamWriter2) fout.createXMLStreamWriter(tmpoutWriter); doc = SMOutputFactory.createOutputDocument(sw, "1.0", "UTF-8", true); doc.setIndentation("\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t", 2, 1); outputRootEl = doc.addElement(Model3dIndex.getRootIndexTag()); for (int i = 0; i < Model3dIndex.getListofAllMetaEntries().size(); i++) { outputRootEl2 = outputRootEl.addElement(Model3dIndex.getMetaEntryTag()); Model3dIndex.getListofAllMetaEntries().elementAt(i).createInfoInDocument(outputRootEl2); } doc.closeRoot(); tmpoutWriter.close(); } catch (Exception e) { return; } }