private Document prepareTBXDocument ( ) throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document tbxDocument = builder . newDocument ( ) ; Element martif = tbxDocument . createElement ( "martif" ) ; martif . setAttribute ( "type" , "TBX" ) ; tbxDocument . appendChild ( martif ) ; Element header = tbxDocument . createElement ( "martifHeader" ) ; martif . appendChild ( header ) ; Element fileDesc = tbxDocument . createElement ( "fileDesc" ) ; header . appendChild ( fileDesc ) ; Element encodingDesc = tbxDocument . createElement ( "encodingDesc" ) ; header . appendChild ( encodingDesc ) ; Element encodingP = tbxDocument . createElement ( "p" ) ; encodingP . setAttribute ( "type" , "XCSURI" ) ; encodingP . setTextContent ( "http://ttc-project.googlecode.com/files/ttctbx.xcs" ) ; encodingDesc . appendChild ( encodingP ) ; Element sourceDesc = tbxDocument . createElement ( "sourceDesc" ) ; Element p = tbxDocument . createElement ( "p" ) ; // p.setTextContent(workingDir.getAbsolutePath()); sourceDesc . appendChild ( p ) ; fileDesc . appendChild ( sourceDesc ) ; Element text = tbxDocument . createElement ( "text" ) ; martif . appendChild ( text ) ; Element body = tbxDocument . createElement ( "body" ) ; text . appendChild ( body ) ; return tbxDocument ; }
Prepare the TBX document that will contain the terms .