| 299 | } |
| 300 | |
| 301 | public NUSTitleInformation readMeta(InputStream bis) { |
| 302 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| 303 | DocumentBuilder builder; |
| 304 | |
| 305 | String ID6 = null; |
| 306 | try { |
| 307 | builder = factory.newDocumentBuilder(); |
| 308 | Document document = builder.parse(bis); |
| 309 | String proc = document.getElementsByTagName("product_code").item(0).getTextContent().toString(); |
| 310 | String comp = document.getElementsByTagName("company_code").item(0).getTextContent().toString(); |
| 311 | String title_id = document.getElementsByTagName("title_id").item(0).getTextContent().toString(); |
| 312 | |
| 313 | String longname = document.getElementsByTagName("longname_en").item(0).getTextContent().toString(); |
| 314 | longname = longname.replace("\n", " "); |
| 315 | String id = proc.substring(proc.length()-4, proc.length()); |
| 316 | comp = comp.substring(comp.length()-2, comp.length()); |
| 317 | ID6 = id+comp; |
| 318 | String company_code = document.getElementsByTagName("company_code").item(0).getTextContent().toString(); |
| 319 | String content_platform = document.getElementsByTagName("content_platform").item(0).getTextContent().toString(); |
| 320 | String region = document.getElementsByTagName("region").item(0).getTextContent().toString(); |
| 321 | NUSTitleInformation nusinfo = new NUSTitleInformation(Util.StringToLong(title_id),longname,ID6,proc,content_platform,company_code,(int) Util.StringToLong(region),new String[1]); |
| 322 | return nusinfo; |
| 323 | |
| 324 | } catch (ParserConfigurationException | SAXException | IOException e) { |
| 325 | Logger.log("Error while parsing the meta files"); |
| 326 | } |
| 327 | return null; |
| 328 | |
| 329 | } |
| 330 | |
| 331 | public FST getFst() { |
| 332 | return fst; |