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.

XMLImage.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 1999-2004 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.image;
  18. // Java
  19. import org.w3c.dom.Document;
  20. // FOP
  21. import org.apache.fop.apps.FOFileHandler;
  22. /**
  23. * This is an implementation for XML-based images such as SVG.
  24. *
  25. * @see AbstractFopImage
  26. * @see FopImage
  27. */
  28. public class XMLImage extends AbstractFopImage {
  29. private Document doc;
  30. private String namespace = "";
  31. /**
  32. * @see org.apache.fop.image.AbstractFopImage#AbstractFopImage(FopImage.ImageInfo)
  33. */
  34. public XMLImage(FopImage.ImageInfo imgInfo) {
  35. super(imgInfo);
  36. if (imgInfo.data instanceof Document) {
  37. doc = (Document)imgInfo.data;
  38. loaded = loaded | ORIGINAL_DATA;
  39. }
  40. namespace = imgInfo.str;
  41. }
  42. /**
  43. * creates a SAX parser, using the value of org.xml.sax.parser
  44. * defaulting to org.apache.xerces.parsers.SAXParser
  45. *
  46. * @return the created SAX parser
  47. */
  48. public static String getParserName() {
  49. String parserClassName = FOFileHandler.getParserClassName();
  50. return parserClassName;
  51. }
  52. /**
  53. * Returns the XML document as a DOM document.
  54. * @return the DOM document
  55. */
  56. public Document getDocument() {
  57. return this.doc;
  58. }
  59. /**
  60. * Returns the namespace of the XML document.
  61. * @return the namespace
  62. */
  63. public String getNameSpace() {
  64. return this.namespace;
  65. }
  66. }