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.

Starter.java 1.2KB

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