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.

ProxyContentHandler.java 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright 2004,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.tools;
  18. import org.xml.sax.Attributes;
  19. import org.xml.sax.ContentHandler;
  20. import org.xml.sax.Locator;
  21. import org.xml.sax.SAXException;
  22. /**
  23. * Simple proxying ContentHandler. It simply forwards all SAX events to its
  24. * delegate ContentHandler.
  25. */
  26. public class ProxyContentHandler implements ContentHandler {
  27. private ContentHandler delegate;
  28. /**
  29. * Constructs a new ProxyContentHandler
  30. * @param delegate the ContentHandler that receives all SAX events.
  31. */
  32. public ProxyContentHandler(ContentHandler delegate) {
  33. super();
  34. this.delegate = delegate;
  35. }
  36. /**
  37. * @return the delegate ContentHandler
  38. */
  39. public ContentHandler getDelegate() {
  40. return this.delegate;
  41. }
  42. /**
  43. * @see org.xml.sax.ContentHandler#startDocument()
  44. */
  45. public void startDocument() throws SAXException {
  46. getDelegate().startDocument();
  47. }
  48. /**
  49. * @see org.xml.sax.ContentHandler#endDocument()
  50. */
  51. public void endDocument() throws SAXException {
  52. getDelegate().endDocument();
  53. }
  54. /**
  55. * @see org.xml.sax.ContentHandler#characters(char[], int, int)
  56. */
  57. public void characters(char[] ch, int start, int length)
  58. throws SAXException {
  59. getDelegate().characters(ch, start, length);
  60. }
  61. /**
  62. * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
  63. */
  64. public void ignorableWhitespace(char[] ch, int start, int length)
  65. throws SAXException {
  66. getDelegate().ignorableWhitespace(ch, start, length);
  67. }
  68. /**
  69. * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
  70. */
  71. public void startElement(String namespaceURI,
  72. String localName, String qName, Attributes atts)
  73. throws SAXException {
  74. getDelegate().startElement(namespaceURI, localName, qName, atts);
  75. }
  76. /**
  77. * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
  78. */
  79. public void endElement(String namespaceURI, String localName, String qName)
  80. throws SAXException {
  81. getDelegate().endElement(namespaceURI, localName, qName);
  82. }
  83. /**
  84. * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
  85. */
  86. public void skippedEntity(String name) throws SAXException {
  87. getDelegate().skippedEntity(name);
  88. }
  89. /**
  90. * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
  91. */
  92. public void setDocumentLocator(Locator locator) {
  93. getDelegate().setDocumentLocator(locator);
  94. }
  95. /**
  96. * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
  97. */
  98. public void processingInstruction(String target, String data)
  99. throws SAXException {
  100. getDelegate().processingInstruction(target, data);
  101. }
  102. /**
  103. * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
  104. */
  105. public void startPrefixMapping(String prefix, String uri)
  106. throws SAXException {
  107. getDelegate().startPrefixMapping(prefix, uri);
  108. }
  109. /**
  110. * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
  111. */
  112. public void endPrefixMapping(String prefix) throws SAXException {
  113. getDelegate().endPrefixMapping(prefix);
  114. }
  115. }