Ejemplo n.º 1
0
 public void endElement(String uri, String localName, String qName) throws SAXException {
   // System.out.println("endElement("+qName+")");
   // if (from_ > 10) System.exit(0);
   if (this.status_ == E_SEG) {
     // save sentence
     if (this.lang_.equalsIgnoreCase("EN")) {
       this.en_ = this.sb_.toString();
     } else if (this.lang_.equalsIgnoreCase("ZH")) {
       this.zh_ = this.sb_.toString();
     }
     if (zh_ != null
         && en_ != null
         && en_.length() > 0
         && zh_.length() > 0
         && en_.length() < 2000
         && zh_.length() < 2000) {
       try {
         long sid = saveUnit(en_, zh_);
         index(this.rs1_, english_, sid, en_);
       } catch (LoadException le) {
         throw new SAXException(le.toString());
       }
       this.en_ = this.zh_ = null;
     }
     // System.out.println(this.sb_.toString());
     this.status_ = E_NONE;
   } else if (qName.equals("header")) {
     System.out.print("saveSource: domain=" + this.domain_ + ", from=" + this.from_);
     try {
       saveSource();
     } catch (LoadException le) {
       throw new SAXException(le.toString());
     }
   }
 }
Ejemplo n.º 2
0
 public void startDocument() throws SAXException {
   // System.out.println("startDocument()");
   try {
     openDatabase();
   } catch (LoadException le) {
     System.err.println(le.getMessage());
     throw new SAXException(le.getMessage());
   }
   try {
     createIndexer();
   } catch (LoadException le) {
     closeDatabase();
     System.err.println(le.getMessage());
     throw new SAXException(le.getMessage());
   }
 }