Package org.kabeja.tools

Examples of org.kabeja.tools.SAXFilterConfig


    List<Map<String,String>> saxFilterProperties = new ArrayList<Map<String,String>>();

    // setup saxfilters
    if (this.saxFilterConfigs.size() > 0) {
      Iterator<SAXFilterConfig> j = saxFilterConfigs.iterator();
      SAXFilterConfig sc = j.next();
      SAXFilter first = this.manager.getSAXFilter(sc.getFilterName());
      saxFilterProperties.add(new MergeMap<String,String>(first.getProperties(), context));

      first.setContentHandler(this.serializer);
      handler = first;
      first.setProperties(sc.getProperties());
          
      while (j.hasNext()) {
        sc = j.next();
        SAXFilter f = this.manager.getSAXFilter(sc.getFilterName());
        f.setContentHandler(first);
        saxFilterProperties.add(f.getProperties());
        f.setProperties(sc.getProperties());
        first = f;
     
      }

    } else {
      // no filter
      handler = this.serializer;
    }

    Map<String,String> oldProbs = this.serializer.getProperties();
    this.serializer.setProperties(new MergeMap<String,String>(this.serializerProperties,context));

    // invoke the filter and serializer
    this.serializer.setOutput(out);

    try {
      Map<String,String> oldGenProps = this.generator.getProperties();
      this.generator.setProperties(this.generatorProperties);
      this.generator.generate(doc, handler, context);
      // restore the old props
      this.generator.setProperties(oldGenProps);
    } catch (SAXException e) {
      throw new ProcessorException(e);
    }

    // restore the serializer properties
    this.serializer.setProperties(oldProbs);

    // restore the filter properties
    for (int x = 0; x < saxFilterProperties.size(); x++) {
      SAXFilterConfig sc = (SAXFilterConfig) saxFilterConfigs.get(x);
      this.manager.getSAXFilter(sc.getFilterName()).setProperties(saxFilterProperties.get(x));
    }
  }
View Full Code Here

TOP

Related Classes of org.kabeja.tools.SAXFilterConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.