Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

FOInputHandler.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2003 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. // Imported SAX classes
  9. import org.xml.sax.InputSource;
  10. import org.xml.sax.XMLReader;
  11. // java
  12. import java.io.File;
  13. import java.net.URL;
  14. /**
  15. * Manages input if it is an xsl:fo file
  16. */
  17. public class FOInputHandler extends InputHandler {
  18. private File fofile = null;
  19. private URL foURL = null;
  20. /*
  21. * Create a FOInputHandler for a file.
  22. * @param file the file to read the FO document.
  23. */
  24. public FOInputHandler (File fofile) {
  25. this.fofile = fofile;
  26. }
  27. /*
  28. * Create a FOInputHandler for an URL.
  29. * @param file the URL to read the FO document.
  30. */
  31. public FOInputHandler (URL url) {
  32. this.foURL = url;
  33. }
  34. /*
  35. * Get the input source associated with this input handler.
  36. */
  37. public InputSource getInputSource () {
  38. if (fofile != null) {
  39. return super.fileInputSource(fofile);
  40. }
  41. return super.urlInputSource(foURL);
  42. }
  43. /*
  44. * Get the SAX parser associated with this input handler.
  45. */
  46. public XMLReader getParser() throws FOPException {
  47. return super.createParser();
  48. }
  49. }