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.4KB

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