You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.apps;
  8. // Avalon
  9. import org.apache.avalon.framework.logger.AbstractLogEnabled;
  10. // SAX
  11. import org.xml.sax.XMLReader;
  12. import org.xml.sax.SAXException;
  13. // Java
  14. import java.io.*;
  15. import java.net.URL;
  16. /**
  17. * abstract super class
  18. * Creates a SAX Parser (defaulting to Xerces).
  19. *
  20. */
  21. public abstract class Starter extends AbstractLogEnabled {
  22. Options options;
  23. InputHandler inputHandler;
  24. public Starter() throws FOPException {
  25. options = new Options();
  26. }
  27. public void setInputHandler(InputHandler inputHandler) {
  28. this.inputHandler = inputHandler;
  29. }
  30. abstract public void run() throws FOPException;
  31. // setting the parser features
  32. public void setParserFeatures(XMLReader parser) throws FOPException {
  33. try {
  34. parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
  35. true);
  36. } catch (SAXException e) {
  37. throw new FOPException("Error: You need a parser which allows the"
  38. + " http://xml.org/sax/features/namespace-prefixes"
  39. + " feature to be set to true to support namespaces", e);
  40. }
  41. }
  42. }