private static Hashtable<String, String> getManifestAttributes(Manifest manifest) { Hashtable<String, String> h = new Hashtable<String, String>(); try { Attributes attrs = manifest.getMainAttributes(); Iterator it = attrs.keySet().iterator(); while (it.hasNext()) { String key = it.next().toString(); h.put(key, attrs.getValue(key)); } } catch (Exception ignore) { } return h; }
// 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), "<", "<", 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) { } }