Esempio n. 1
0
 // Ende des Dokuments
 public void endDocument() {
   try {
     f.close();
   } catch (IOException e) {
     EfaUtil.foo();
   }
 }
Esempio n. 2
0
 // Anfang des Dokuments
 public void startDocument() {
   try {
     f.write("<?xml version=\"1.0\" encoding=\"" + Daten.ENCODING_UTF + "\"?>\n");
   } catch (IOException e) {
     EfaUtil.foo();
   }
 }
Esempio n. 3
0
 public int runXmlImport() {
   DataImportXmlParser responseHandler = null;
   try {
     XMLReader parser = EfaUtil.getXMLReader();
     responseHandler = new DataImportXmlParser(this, dataAccess);
     parser.setContentHandler(responseHandler);
     parser.parse(new InputSource(new FileInputStream(filename)));
   } catch (Exception e) {
     logInfo(e.toString());
     errorCount++;
     Logger.log(e);
     if (Daten.isGuiAppl()) {
       Dialog.error(e.toString());
     }
   }
   return (responseHandler != null ? responseHandler.getImportedRecordsCount() : 0);
 }
Esempio n. 4
0
  // Beginn eines Element-Tags
  public void startElement(String uri, String localName, String qname, Attributes atts) {
    try {
      if (uri.equals("http://www.nmichael.de/elwiz")) {

        // Elemente des elwiz-Namensraums

        if (!localName.equals("option")) { // Hauptelement
          // Namen ermitteln
          String name = null;
          for (int i = 0; i < atts.getLength(); i++)
            if (atts.getLocalName(i).equals("name")) name = atts.getValue(i);

          // Element suchen
          for (int i = 0; i < options.size(); i++)
            if (((ElwizOption) options.get(i)).name.equals(name)) {
              this.option = (ElwizOption) options.get(i);
              break;
            }

        } else { // Unterelement

          // Position des Unterelements für Zugriff auf options-Vektor ermitteln
          int pos = -1;
          for (int i = 0; i < atts.getLength(); i++)
            if (atts.getLocalName(i).equals("pos")) pos = EfaUtil.string2int(atts.getValue(i), -1);

          if (option != null)
            switch (option.type) {
              case ElwizOption.O_OPTIONAL: // optional
                JCheckBox o1 = (JCheckBox) option.components.get(pos);
                if (!o1.isSelected()) skip = true;
                break;
              case ElwizOption.O_SELECT: // select
                JRadioButton o2 = (JRadioButton) option.components.get(pos);
                if (!o2.isSelected()) skip = true;
                ElwizSingleOption eso = (ElwizSingleOption) option.options.get(pos);
                if (!skip && eso.value != null) f.write(eso.value);
                break;
              case ElwizOption.O_VALUE: // value
                JTextField o3 = (JTextField) option.components.get(pos);
                f.write(o3.getText().trim());
                break;
            }
        }

      } else {

        // Elemente des XSLT-Namensraums

        if (skip) return; // Element unterdrücken?

        f.write("<" + qname);
        for (int i = 0; i < atts.getLength(); i++) {
          f.write(
              " "
                  + atts.getLocalName(i)
                  + "=\""
                  + EfaUtil.replace(atts.getValue(i), "<", "&lt;", true)
                  + "\"");
        }
        if (localName.equals("stylesheet"))
          f.write(
              " xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"");
        f.write(">");
      }
    } catch (IOException e) {
    }
  }