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.

XMLHandler.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 1999-2005 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.render;
  18. import org.w3c.dom.Document;
  19. /**
  20. * This interface is implemented by classes that can handle a certain type
  21. * of foreign objects.
  22. */
  23. public interface XMLHandler {
  24. /** Used to indicate that all MIME types or XML namespaces are handled. */
  25. String HANDLE_ALL = "*";
  26. /**
  27. * <p>Handle an external xml document inside a Foreign Object Area.
  28. * </p>
  29. * <p>This may throw an exception if for some reason it cannot be handled. The
  30. * caller is expected to deal with this exception.
  31. * </p>
  32. * <p>The implementation may convert the XML document internally to another
  33. * XML dialect (SVG, for example) and call renderXML() on the AbstractRenderer
  34. * again (which can be retrieved through the RendererContext).</p>
  35. *
  36. * @param context The RendererContext (contains the user agent)
  37. * @param doc A DOM containing the foreign object to be
  38. * processed
  39. * @param ns The Namespace of the foreign object
  40. * @exception Exception If an error occurs during processing.
  41. */
  42. void handleXML(RendererContext context,
  43. Document doc, String ns) throws Exception;
  44. /**
  45. * Checks if this XMLHandler supports handling an XML namespace for a particular renderer.
  46. * @param renderer the renderer for which to check.
  47. * @return true if this XML handler supports a particular renderer
  48. */
  49. boolean supportsRenderer(Renderer renderer);
  50. /**
  51. * @return the XML namespace for the XML dialect this XMLHandler supports,
  52. * null if all XML content is handled by this instance.
  53. */
  54. String getNamespace();
  55. }