1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 2001, 2002 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xerces" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 1999, International
  53. * Business Machines, Inc., http://www.apache.org. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package com.sun.org.apache.xerces.internal.xni;
  58. /**
  59. * This handler interface contains methods necessary to receive
  60. * information about document elements and content.
  61. * <p>
  62. * <strong>Note:</strong> Some of these methods overlap methods
  63. * found in the XMLDocumentHandler interface.
  64. *
  65. * @see XMLDocumentHandler
  66. *
  67. * @author Andy Clark, IBM
  68. * @version $Id: XMLDocumentFragmentHandler.java,v 1.6 2002/12/16 01:26:21 elena Exp $
  69. */
  70. public interface XMLDocumentFragmentHandler {
  71. //
  72. // XMLDocumentFragmentHandler methods
  73. //
  74. /**
  75. * The start of the document fragment.
  76. *
  77. * @param locator The document locator, or null if the
  78. * document location cannot be reported
  79. * during the parsing of this fragment.
  80. * However, it is <em>strongly</em>
  81. * recommended that a locator be supplied
  82. * that can at least report the base
  83. * system identifier.
  84. * @param namespaceContext The namespace context in effect at the
  85. * start of this document fragment. This
  86. * object only represents the current context.
  87. * Implementors of this class are responsible
  88. * for copying the namespace bindings from the
  89. * the current context (and its parent contexts)
  90. * if that information is important.
  91. * @param augmentations Additional information that may include infoset
  92. * augmentations.
  93. *
  94. * @throws XNIException Thrown by handler to signal an error.
  95. */
  96. public void startDocumentFragment(XMLLocator locator,
  97. NamespaceContext namespaceContext,
  98. Augmentations augmentations)
  99. throws XNIException;
  100. /**
  101. * This method notifies the start of a general entity.
  102. * <p>
  103. * <strong>Note:</strong> This method is not called for entity references
  104. * appearing as part of attribute values.
  105. *
  106. * @param name The name of the general entity.
  107. * @param identifier The resource identifier.
  108. * @param encoding The auto-detected IANA encoding name of the entity
  109. * stream. This value will be null in those situations
  110. * where the entity encoding is not auto-detected (e.g.
  111. * internal entities or a document entity that is
  112. * parsed from a java.io.Reader).
  113. * @param augmentations Additional information that may include infoset
  114. * augmentations.
  115. *
  116. * @throws XNIException Thrown by handler to signal an error.
  117. */
  118. public void startGeneralEntity(String name,
  119. XMLResourceIdentifier identifier,
  120. String encoding,
  121. Augmentations augmentations) throws XNIException;
  122. /**
  123. * Notifies of the presence of a TextDecl line in an entity. If present,
  124. * this method will be called immediately following the startEntity call.
  125. * <p>
  126. * <strong>Note:</strong> This method will never be called for the
  127. * document entity; it is only called for external general entities
  128. * referenced in document content.
  129. * <p>
  130. * <strong>Note:</strong> This method is not called for entity references
  131. * appearing as part of attribute values.
  132. *
  133. * @param version The XML version, or null if not specified.
  134. * @param encoding The IANA encoding name of the entity.
  135. * @param augmentations Additional information that may include infoset
  136. * augmentations.
  137. *
  138. * @throws XNIException Thrown by handler to signal an error.
  139. */
  140. public void textDecl(String version, String encoding,
  141. Augmentations augmentations) throws XNIException;
  142. /**
  143. * This method notifies the end of a general entity.
  144. * <p>
  145. * <strong>Note:</strong> This method is not called for entity references
  146. * appearing as part of attribute values.
  147. *
  148. * @param name The name of the general entity.
  149. * @param augmentations Additional information that may include infoset
  150. * augmentations.
  151. *
  152. * @throws XNIException Thrown by handler to signal an error.
  153. */
  154. public void endGeneralEntity(String name, Augmentations augmentations)
  155. throws XNIException;
  156. /**
  157. * A comment.
  158. *
  159. * @param text The text in the comment.
  160. * @param augmentations Additional information that may include infoset
  161. * augmentations.
  162. *
  163. * @throws XNIException Thrown by application to signal an error.
  164. */
  165. public void comment(XMLString text, Augmentations augmentations)
  166. throws XNIException;
  167. /**
  168. * A processing instruction. Processing instructions consist of a
  169. * target name and, optionally, text data. The data is only meaningful
  170. * to the application.
  171. * <p>
  172. * Typically, a processing instruction's data will contain a series
  173. * of pseudo-attributes. These pseudo-attributes follow the form of
  174. * element attributes but are <strong>not</strong> parsed or presented
  175. * to the application as anything other than text. The application is
  176. * responsible for parsing the data.
  177. *
  178. * @param target The target.
  179. * @param data The data or null if none specified.
  180. * @param augmentations Additional information that may include infoset
  181. * augmentations.
  182. *
  183. * @throws XNIException Thrown by handler to signal an error.
  184. */
  185. public void processingInstruction(String target, XMLString data,
  186. Augmentations augmentations)
  187. throws XNIException;
  188. /**
  189. * The start of an element.
  190. *
  191. * @param element The name of the element.
  192. * @param attributes The element attributes.
  193. * @param augmentations Additional information that may include infoset
  194. * augmentations.
  195. *
  196. * @throws XNIException Thrown by handler to signal an error.
  197. */
  198. public void startElement(QName element, XMLAttributes attributes,
  199. Augmentations augmentations) throws XNIException;
  200. /**
  201. * An empty element.
  202. *
  203. * @param element The name of the element.
  204. * @param attributes The element attributes.
  205. * @param augmentations Additional information that may include infoset
  206. * augmentations.
  207. *
  208. * @throws XNIException Thrown by handler to signal an error.
  209. */
  210. public void emptyElement(QName element, XMLAttributes attributes,
  211. Augmentations augmentations) throws XNIException;
  212. /**
  213. * Character content.
  214. *
  215. * @param text The content.
  216. * @param augmentations Additional information that may include infoset
  217. * augmentations.
  218. *
  219. * @throws XNIException Thrown by handler to signal an error.
  220. */
  221. public void characters(XMLString text, Augmentations augmentations)
  222. throws XNIException;
  223. /**
  224. * Ignorable whitespace. For this method to be called, the document
  225. * source must have some way of determining that the text containing
  226. * only whitespace characters should be considered ignorable. For
  227. * example, the validator can determine if a length of whitespace
  228. * characters in the document are ignorable based on the element
  229. * content model.
  230. *
  231. * @param text The ignorable whitespace.
  232. * @param augmentations Additional information that may include infoset
  233. * augmentations.
  234. *
  235. * @throws XNIException Thrown by handler to signal an error.
  236. */
  237. public void ignorableWhitespace(XMLString text,
  238. Augmentations augmentations)
  239. throws XNIException;
  240. /**
  241. * The end of an element.
  242. *
  243. * @param element The name of the element.
  244. * @param augmentations Additional information that may include infoset
  245. * augmentations.
  246. *
  247. * @throws XNIException Thrown by handler to signal an error.
  248. */
  249. public void endElement(QName element, Augmentations augmentations)
  250. throws XNIException;
  251. /**
  252. * The start of a CDATA section.
  253. *
  254. * @param augmentations Additional information that may include infoset
  255. * augmentations.
  256. *
  257. * @throws XNIException Thrown by handler to signal an error.
  258. */
  259. public void startCDATA(Augmentations augmentations) throws XNIException;
  260. /**
  261. * The end of a CDATA section.
  262. *
  263. * @param augmentations Additional information that may include infoset
  264. * augmentations.
  265. *
  266. * @throws XNIException Thrown by handler to signal an error.
  267. */
  268. public void endCDATA(Augmentations augmentations) throws XNIException;
  269. /**
  270. * The end of the document fragment.
  271. *
  272. * @param augmentations Additional information that may include infoset
  273. * augmentations.
  274. *
  275. * @throws XNIException Thrown by handler to signal an error.
  276. */
  277. public void endDocumentFragment(Augmentations augmentations)
  278. throws XNIException;
  279. } // interface XMLDocumentFragmentHandler