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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * @return the MIME type for which this XMLHandler was written
  46. */
  47. String getMimeType();
  48. /**
  49. * @return the XML namespace for the XML dialect this XMLHandler supports,
  50. * null if all XML content is handled by this instance.
  51. */
  52. String getNamespace();
  53. }