/plugins/XSLT/tags/xslt_0_5_2/xslt/EntityResolverImpl.java

# · Java · 50 lines · 19 code · 8 blank · 23 comment · 0 complexity · d639fe1b241e6859bd3296d120ab1188 MD5 · raw file

  1. /*
  2. * EntityResolverImpl.java - Entity resolver
  3. *
  4. * Copyright (c) 2003 Robert McKinnon
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. */
  20. package xslt;
  21. import org.xml.sax.EntityResolver;
  22. import org.xml.sax.InputSource;
  23. import org.xml.sax.SAXException;
  24. import xml.CatalogManager;
  25. import java.io.IOException;
  26. /**
  27. * Entity resolver that makes use of {@link CatalogManager}.
  28. *@author Robert McKinnon
  29. */
  30. public class EntityResolverImpl implements EntityResolver {
  31. private String inputPath;
  32. public EntityResolverImpl(String inputPath) {
  33. this.inputPath = inputPath;
  34. }
  35. public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
  36. try {
  37. return CatalogManager.resolve(inputPath, publicId, systemId);
  38. } catch(Exception e) {
  39. throw new SAXException(e);
  40. }
  41. }
  42. }