Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

UnknownXMLObj.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.fo;
  18. import org.xml.sax.Locator;
  19. /**
  20. * Class for handling generic XML from a namespace not recognized by FOP
  21. */
  22. public class UnknownXMLObj extends XMLObj {
  23. private String namespace;
  24. /**
  25. * Inner class for an UnknownXMLObj Maker
  26. */
  27. public static class Maker extends ElementMapping.Maker {
  28. private String space;
  29. /**
  30. * Construct the Maker
  31. * @param sp the namespace for this Maker
  32. */
  33. public Maker(String sp) {
  34. space = sp;
  35. }
  36. /**
  37. * Make an instance
  38. * @param parent FONode that is the parent of the object
  39. * @return the created UnknownXMLObj
  40. */
  41. public FONode make(FONode parent) {
  42. return new UnknownXMLObj(parent, space);
  43. }
  44. }
  45. /**
  46. * Constructs an unknown xml object (called by Maker).
  47. *
  48. * @param parent the parent formatting object
  49. * @param space the namespace for this object
  50. */
  51. protected UnknownXMLObj(FONode parent, String space) {
  52. super(parent);
  53. this.namespace = space;
  54. }
  55. /**
  56. * @see XMLObj#getNameSpace
  57. */
  58. public String getNameSpace() {
  59. return this.namespace;
  60. }
  61. /**
  62. * @see XMLObj#addChild
  63. */
  64. protected void addChild(FONode child) {
  65. if (doc == null) {
  66. createBasicDocument();
  67. }
  68. super.addChild(child);
  69. }
  70. /**
  71. * @see XMLObj#addCharacters
  72. */
  73. protected void addCharacters(char data[], int start, int length,
  74. Locator locator) {
  75. if (doc == null) {
  76. createBasicDocument();
  77. }
  78. super.addCharacters(data, start, length, locator);
  79. }
  80. /**
  81. * This is a hook for an FOTreeVisitor subclass to be able to access
  82. * this object.
  83. * @param fotv the FOTreeVisitor subclass that can access this object.
  84. * @see org.apache.fop.fo.FOTreeVisitor
  85. */
  86. public void acceptVisitor(FOTreeVisitor fotv) {
  87. fotv.serveUnknownXMLObj(this);
  88. }
  89. }