]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Used in xml-parsing.ehtml
authorPeter Bernard West <pbwest@apache.org>
Wed, 12 Mar 2003 14:56:46 +0000 (14:56 +0000)
committerPeter Bernard West <pbwest@apache.org>
Wed, 12 Mar 2003 14:56:46 +0000 (14:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196086 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/design/alt.design/FoXMLEvent.html [new file with mode: 0644]
src/documentation/content/design/alt.design/SyncedFoXmlEventsBuffer.html [new file with mode: 0644]
src/documentation/content/design/alt.design/XMLNamespaces.html [new file with mode: 0644]

diff --git a/src/documentation/content/design/alt.design/FoXMLEvent.html b/src/documentation/content/design/alt.design/FoXMLEvent.html
new file mode 100644 (file)
index 0000000..b2f9a05
--- /dev/null
@@ -0,0 +1,214 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!-- Created by htmlize-0.67 in css mode. -->
+<html>
+  <head>
+    <title>FoXMLEvent.java</title>
+    <style type="text/css">
+    <!--
+      body {
+        color: #000000;
+        background-color: #faf0e6;
+      } /* default */
+      .comment {
+        color: #00008b;
+        background-color: #faf0e6;
+      } /* font-lock-comment-face */
+      .jde-java-font-lock-package {
+        color: #0000cd;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-package-face */
+      .jde-java-font-lock-constant {
+        color: #5f9ea0;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-constant-face */
+      .function-name {
+        color: #8b2323;
+        background-color: #faf0e6;
+      } /* font-lock-function-name-face */
+      .variable-name {
+        color: #8b008b;
+        background-color: #faf0e6;
+      } /* font-lock-variable-name-face */
+      .jde-java-font-lock-doc-tag {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-doc-tag-face */
+      .keyword {
+        color: #8b0000;
+        background-color: #faf0e6;
+      } /* font-lock-keyword-face */
+      .jde-java-font-lock-italic {
+        background-color: #faf0e6;
+        font-style: italic;
+      } /* jde-java-font-lock-italic-face */
+      .jde-java-font-lock-modifier {
+        color: #da70d6;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-modifier-face */
+      .string {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* font-lock-string-face */
+      .type {
+        color: #4682b4;
+        background-color: #faf0e6;
+      } /* font-lock-type-face */
+      a {
+        color: inherit;
+        background-color: inherit;
+        font: inherit;
+        text-decoration: inherit;
+      }
+      a:hover {
+        text-decoration: underline;
+      }
+    -->
+    </style>
+  </head>
+  <body>
+    <pre>
+<span class="keyword">package</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">xml</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">apps</span>.<span class="type">FOPException</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">fo</span>.<span class="type">FObjectNames</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">xml</span>.<span class="jde-java-font-lock-package">sax</span>.<span class="jde-java-font-lock-package">helpers</span>.<span class="type">AttributesImpl</span>;
+
+<span class="comment">/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ * @author &lt;a href=&quot;mailto:pbwest@powerup.com.au&quot;&gt;Peter B. West&lt;/a&gt;
+ * @version $Revision$ $Name$
+ */</span>
+<span class="comment">/**
+ * This is a data class to encapsulate the data of an individual XML
+ * parse event in an XML-FO file. The current version, while defining
+ * accessor methods, leaves the component data of the event as protected.
+ * The &lt;tt&gt;XMLSerialHandler&lt;/tt&gt; methods set the values directly.
+ */</span>
+
+<span class="jde-java-font-lock-modifier">public</span> <span class="keyword">class</span> <span class="function-name" id="FoXMLEventClass">FoXMLEvent</span> <span class="keyword">extends</span> <span class="type">XMLEvent</span> {
+
+    <span class="jde-java-font-lock-modifier">private</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="tag">tag</span> = &quot;<span class="string">$Name$</span>&quot;;
+    <span class="jde-java-font-lock-modifier">private</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="revision">revision</span> = &quot;<span class="string">$Revision$</span>&quot;;
+
+    <span class="comment">/** The FO type, as defined in FObjectNames, of fo: XML events. */</span>
+    <span class="jde-java-font-lock-modifier">protected</span> <span class="type">int</span> <span class="variable-name" id="foType">foType</span> = FObjectNames.<span class="jde-java-font-lock-constant" id="NO_FO">NO_FO</span>;
+
+    <span class="comment">/**
+     * The one-argument constructor uses the default initialization values:
+     * NOEVENT for the event &lt;i&gt;</span><span class="jde-java-font-lock-italic">type</span><span class="comment">&lt;/i&gt;, and null references for all others
+     * except &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces</span><span class="comment">&lt;/i&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name" id="FoXMLEvent">FoXMLEvent</span> (<span class="type">XMLNamespaces</span> <span class="variable-name" id="namespaces">namespaces</span>) {
+        <span class="keyword">super</span>(namespaces);
+    }
+
+    <span class="comment">/**
+     * The fully defined constructor takes values for each of the data
+     * elements.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name">FoXMLEvent</span>(<span class="type">int</span> <span class="variable-name" id="type">type</span>, <span class="type">String</span> <span class="variable-name">chars</span>, <span class="type">int</span> <span class="variable-name">uriIndex</span>,
+                    <span class="type">String</span> <span class="variable-name" id="localName">localName</span>, <span class="type">String</span> <span class="variable-name">qName</span>,
+                    <span class="type">AttributesImpl</span> <span class="variable-name" id="attributes">attributes</span>, <span class="type">XMLNamespaces</span> <span class="variable-name">namespaces</span>,
+                    <span class="type">int</span> <span class="variable-name">foType</span>)
+    {
+        <span class="keyword">super</span>
+            (type, chars, uriIndex, localName, qName, attributes, namespaces);
+        <span class="keyword">this</span>.foType = foType;
+    }
+
+    <span class="comment">/**
+     * The cloning constructor takes a reference to an existing
+     * &lt;tt&gt;FoXMLEvent&lt;/tt&gt; object.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name">FoXMLEvent</span>(<span class="type">FoXMLEvent</span> <span class="variable-name" id="ev">ev</span>) {
+        <span class="keyword">super</span>(ev);
+        foType = ev.foType;
+    }
+
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name">FoXMLEvent</span>(<span class="type">int</span> <span class="variable-name">type</span>, <span class="type">String</span> <span class="variable-name">chars</span>, <span class="type">XMLNamespaces</span> <span class="variable-name">namespaces</span>) {
+        <span class="keyword">super</span>(type, chars, namespaces);
+    }
+
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name">FoXMLEvent</span>(<span class="type">int</span> <span class="variable-name">type</span>, <span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">AttributesImpl</span> <span class="variable-name">attributes</span>,
+                    <span class="type">XMLNamespaces</span> <span class="variable-name">namespaces</span>, <span class="type">int</span> <span class="variable-name">foType</span>) {
+        <span class="keyword">super</span>(namespaces);
+        <span class="keyword">this</span>.type = type;
+        <span class="keyword">this</span>.uriIndex = uriIndex;
+        <span class="keyword">this</span>.attributes = attributes;
+        <span class="keyword">this</span>.foType = foType;
+    }
+
+    <span class="comment">/**
+     * Clear the fields of this event.  Provided for pool operations.
+     * Neither the &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces&lt;/i&gt; nor the &lt;i&gt;id</span><span class="comment">&lt;/i&gt; field is cleared.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the cleared &lt;tt&gt;XMLEvent&lt;/tt&gt; event.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">XMLEvent</span> <span class="function-name" id="clear">clear</span>() {
+        foType = FObjectNames.<span class="jde-java-font-lock-constant">NO_FO</span>;
+        <span class="keyword">return</span> <span class="keyword">super</span>.clear();
+    }
+
+    <span class="comment">/**
+     * Clear the fields of this event.  Provided for pool operations.
+     * Neither the &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces&lt;/i&gt; nor the &lt;i&gt;id</span><span class="comment">&lt;/i&gt; field is cleared.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the cleared &lt;tt&gt;XMLEvent&lt;/tt&gt; event.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="clearFo">clearFo</span>() {
+        <span class="keyword">return</span> (<span class="type">FoXMLEvent</span>)clear();
+    }
+
+    <span class="comment">/**
+     * Copy the fields of the argument event to this event.
+     * Provided for pool operations.
+     * Neither the &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces&lt;/i&gt; nor the &lt;i&gt;id</span><span class="comment">&lt;/i&gt; field is copied.
+     * The &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces</span><span class="comment">&lt;/i&gt; field is not cleared.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">ev</span><span class="comment"> the &lt;tt&gt;XMLEvent&lt;/tt&gt; to copy.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the copied &lt;tt&gt;XMLEvent&lt;/tt&gt; event.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">XMLEvent</span> <span class="function-name" id="copyEvent">copyEvent</span>(<span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>) {
+        foType = ev.foType;
+        <span class="keyword">return</span> <span class="keyword">super</span>.copyEvent(ev);
+    }
+
+    <span class="comment">/**
+     * Copy the fields of the argument event to this event.
+     * Provided for pool operations.
+     * Neither the &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces&lt;/i&gt; nor the &lt;i&gt;id</span><span class="comment">&lt;/i&gt; field is copied.
+     * The &lt;i&gt;</span><span class="jde-java-font-lock-italic">namespaces</span><span class="comment">&lt;/i&gt; field is not cleared.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the copied &lt;tt&gt;XMLEvent&lt;/tt&gt; event.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="copyFoEvent">copyFoEvent</span>(<span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>) {
+        <span class="keyword">return</span> (<span class="type">FoXMLEvent</span>)copyEvent(ev);
+    }
+
+    <span class="comment">/**
+     * Get the FO type of this &lt;i&gt;</span><span class="jde-java-font-lock-italic">FoXMLEvent</span><span class="comment">&lt;/i&gt;.
+     * </span><span class="jde-java-font-lock-doc-tag">@returns</span><span class="comment"> the FO type.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">int</span> <span class="function-name" id="getFoType">getFoType</span>() { <span class="keyword">return</span> foType; }
+
+    <span class="comment">/**
+     * Set the FO type of this &lt;i&gt;</span><span class="jde-java-font-lock-italic">FoXMLEvent</span><span class="comment">&lt;/i&gt;.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> -the FO type.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">void</span> <span class="function-name" id="setFoType">setFoType</span>(<span class="type">int</span> <span class="variable-name">foType</span>) { <span class="keyword">this</span>.foType = foType; }
+
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">String</span> <span class="function-name" id="toString">toString</span>() {
+        <span class="type">String</span> <span class="variable-name" id="tstr">tstr</span>;
+        <span class="keyword">try</span> {
+            tstr = &quot;<span class="string">FO type: </span>&quot; + FObjectNames.getFOName(foType) + &quot;<span class="string">\n</span>&quot;;
+        } <span class="keyword">catch</span> (<span class="type">FOPException</span> <span class="variable-name" id="e">e</span>) {
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">RuntimeException</span>(e.getMessage());
+        }
+        tstr = tstr + <span class="keyword">super</span>.toString();
+        <span class="keyword">return</span> tstr;
+    }
+
+}
+</pre>
+  </body>
+</html>
diff --git a/src/documentation/content/design/alt.design/SyncedFoXmlEventsBuffer.html b/src/documentation/content/design/alt.design/SyncedFoXmlEventsBuffer.html
new file mode 100644 (file)
index 0000000..6a63998
--- /dev/null
@@ -0,0 +1,1344 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!-- Created by htmlize-0.67 in css mode. -->
+<html>
+  <head>
+    <title>SyncedFoXmlEventsBuffer.java</title>
+    <style type="text/css">
+    <!--
+      body {
+        color: #000000;
+        background-color: #faf0e6;
+      } /* default */
+      .reference {
+        color: #cd0000;
+        background-color: #faf0e6;
+      } /* font-lock-reference-face */
+      .comment {
+        color: #00008b;
+        background-color: #faf0e6;
+      } /* font-lock-comment-face */
+      .jde-java-font-lock-package {
+        color: #0000cd;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-package-face */
+      .jde-java-font-lock-constant {
+        color: #5f9ea0;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-constant-face */
+      .function-name {
+        color: #8b2323;
+        background-color: #faf0e6;
+      } /* font-lock-function-name-face */
+      .variable-name {
+        color: #8b008b;
+        background-color: #faf0e6;
+      } /* font-lock-variable-name-face */
+      .jde-java-font-lock-bold {
+        background-color: #faf0e6;
+        font-weight: bold;
+      } /* jde-java-font-lock-bold-face */
+      .jde-java-font-lock-doc-tag {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-doc-tag-face */
+      .keyword {
+        color: #8b0000;
+        background-color: #faf0e6;
+      } /* font-lock-keyword-face */
+      .jde-java-font-lock-number {
+        color: #bc8f8f;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-number-face */
+      .jde-java-font-lock-code {
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-code-face */
+      .jde-java-font-lock-italic {
+        background-color: #faf0e6;
+        font-style: italic;
+      } /* jde-java-font-lock-italic-face */
+      .jde-java-font-lock-modifier {
+        color: #da70d6;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-modifier-face */
+      .string {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* font-lock-string-face */
+      .type {
+        color: #4682b4;
+        background-color: #faf0e6;
+      } /* font-lock-type-face */
+      a {
+        color: inherit;
+        background-color: inherit;
+        font: inherit;
+        text-decoration: inherit;
+      }
+      a:hover {
+        text-decoration: underline;
+      }
+    -->
+    </style>
+  </head>
+  <body>
+    <pre>
+<span class="keyword">package</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">xml</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">datastructs</span>.<span class="type">SyncedCircularBuffer</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">apps</span>.<span class="type">FOPException</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">fo</span>.<span class="type">FObjectNames</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">fo</span>.<span class="type">FObjectSets</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">xml</span>.<span class="type">FoXMLEventPool</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">NoSuchElementException</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">LinkedList</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">Iterator</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">BitSet</span>;
+
+<span class="comment">/*
+ * $Id$
+ * 
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ *
+ * @author &lt;a href=&quot;mailto:pbwest@powerup.com.au&quot;&gt;Peter B. West&lt;/a&gt;
+ * @version $Revision$ $Name$
+ */</span>
+<span class="comment">/**
+ * A synchronized circular buffer for FoXMLEvents.
+ * </span><span class="jde-java-font-lock-doc-tag">@see</span><span class="comment"> </span><span class="jde-java-font-lock-code">org.apache.fop.datastructs.SyncedCircularBuffer</span><span class="comment">
+ */</span>
+<span class="jde-java-font-lock-modifier">public</span> <span class="keyword">class</span> <span class="function-name" id="SyncedFoXmlEventsBufferClass">SyncedFoXmlEventsBuffer</span> <span class="keyword">extends</span> <span class="type">SyncedCircularBuffer</span> {
+
+    <span class="comment">/**
+     * Constant for &lt;i&gt;</span><span class="jde-java-font-lock-italic">discardEvent</span><span class="comment">&lt;/i&gt; field of
+     * &lt;i&gt;getEndElement(boolean discardEvent, FoXMLEvent(, boolean)).
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">boolean</span> <span class="variable-name" id="DISCARD_EV">DISCARD_EV</span> = <span class="jde-java-font-lock-constant" id="true">true</span>,
+                                 <span class="jde-java-font-lock-constant" id="RETAIN_EV">RETAIN_EV</span> = <span class="jde-java-font-lock-constant">false</span>;
+
+    <span class="comment">/**
+     * Maintains an index of namespace URIs.  These can then be referred to
+     * by an &lt;tt&gt;int&lt;/tt&gt; index.
+     */</span>
+    <span class="jde-java-font-lock-modifier">private</span> <span class="type">XMLNamespaces</span> <span class="variable-name" id="namespaces">namespaces</span>;
+
+    <span class="comment">/**
+     * The FoXMLEventPool for this buffer.
+     */</span>
+    <span class="jde-java-font-lock-modifier">private</span> <span class="type">FoXMLEventPool</span> <span class="variable-name" id="pool">pool</span>;
+
+    <span class="comment">/**
+     * No-argument constructor sets up a buffer with the default number of
+     * elements.
+     * The producer and consumer &lt;tt&gt;Thread&lt;/tt&gt;s default to the current
+     * thread at the time of instantiation.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name" id="SyncedFoXmlEventsBuffer">SyncedFoXmlEventsBuffer</span>()
+        <span class="keyword">throws</span> <span class="type">IllegalArgumentException</span>
+    {
+        <span class="keyword">super</span>();
+        namespaces = <span class="keyword">new</span> <span class="type">XMLNamespaces</span>();
+        pool = <span class="keyword">new</span> <span class="type">FoXMLEventPool</span>(namespaces, <span class="jde-java-font-lock-constant" id="DEFAULTBUFSIZE">DEFAULTBUFSIZE</span>);
+    }
+
+    <span class="comment">/**
+     * Constructor taking one argument; the size of the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="size">size</span><span class="comment"> the size of the buffer.  Must be &gt; 1.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name">SyncedFoXmlEventsBuffer</span>(<span class="type">int</span> <span class="variable-name">size</span>)
+        <span class="keyword">throws</span> <span class="type">IllegalArgumentException</span>
+    {
+        <span class="keyword">super</span>(size);
+        namespaces = <span class="keyword">new</span> <span class="type">XMLNamespaces</span>();
+        pool = <span class="keyword">new</span> <span class="type">FoXMLEventPool</span>(namespaces);
+    }
+
+    <span class="comment">/**
+     * Get the &lt;tt&gt;XMLNamespaces&lt;/tt&gt; from this buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> - the namespaces object.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">XMLNamespaces</span> <span class="function-name" id="getNamespaces">getNamespaces</span>() { <span class="keyword">return</span> namespaces; }
+
+    <span class="comment">/**
+     * Get the &lt;tt&gt;FoXMLEventPool&lt;/tt&gt; from this buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> - the pool object.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEventPool</span> <span class="function-name" id="getPool">getPool</span>() { <span class="keyword">return</span> pool; }
+
+    <span class="comment">/**
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> next event from the SyncedCircularBuffer
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException.</span><span class="comment">  The purpose of this method is to catch
+     * and transform any InterruptedException exceptions thrown by the
+     * &lt;tt&gt;SyncedCircularBuffer&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getEvent">getEvent</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="type">FoXMLEvent</span> <span class="variable-name" id="ev">ev</span>;
+        <span class="keyword">try</span> {
+            ev = (<span class="type">FoXMLEvent</span>)get();
+            <span class="comment">//System.out.println(&quot;getEvent: &quot; + ev);
+</span>            <span class="keyword">return</span> ev;
+        } <span class="keyword">catch</span> (<span class="type">InterruptedException</span> <span class="variable-name" id="e">e</span>) {
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">FOPException</span>(e);
+        }
+    }
+
+    <span class="comment">/**
+     * Get the next event of the given type from the buffer.  Discard
+     * intervening events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="eventType">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the given type.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getTypedEvent">getTypedEvent</span>(<span class="type">int</span> <span class="variable-name">eventType</span>) <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant" id="null">null</span> &amp;&amp; ev.type != eventType) {
+            ev = getEvent();
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>) {
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                        (XMLEvent.eventTypeName(eventType) + &quot;<span class="string"> not found.</span>&quot;);
+        }
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Get the next event of the given type and with the given &lt;tt&gt;QName&lt;/tt&gt;
+     * from the buffer.  Discard intervening events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="qName">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required element.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the given type.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getTypedEvent</span>(<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">String</span> <span class="variable-name">qName</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp;
+               ! (ev.type == eventType &amp;&amp; ev.qName.equals(qName))) {
+            ev = getEvent();
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>) {
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+            (XMLEvent.eventTypeName(eventType) + &quot;<span class="string"> </span>&quot; + qName + &quot;<span class="string"> not found.</span>&quot;);
+        }
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Get the next event of the given type, and with the given URI index and
+     * local name, from the buffer.  Discard intervening events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="uriIndex">uriIndex</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; URI index maintained in the
+     * &lt;tt&gt;XMLNamespaces&lt;/tt&gt; object.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="localName">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required element.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the given type.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">getTypedEvent</span>
+                            (<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">String</span> <span class="variable-name">localName</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp;
+               ! (ev.type == eventType
+                  &amp;&amp; ev.uriIndex == uriIndex
+                  &amp;&amp; ev.localName.equals(localName))) {
+            pool.surrenderEvent(ev);
+            ev = getEvent();
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (XMLEvent.eventTypeName(eventType)
+                             + namespaces.getIndexURI(uriIndex)
+                                       + &quot;<span class="string">:</span>&quot; + localName + &quot;<span class="string"> not found.</span>&quot;);
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Get the next event of the given type, from the fo: namespace, with
+     * the given FO type.  Discard intervening events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="foType">foType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; FO type.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the given type.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getTypedEvent</span>(<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">int</span> <span class="variable-name">foType</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp;
+               ! (ev.type == eventType &amp;&amp; ev.foType == foType)) {
+            pool.surrenderEvent(ev);
+            ev = getEvent();
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (XMLEvent.eventTypeName(eventType)
+                             + &quot;<span class="string"> FO type </span>&quot; + foType + &quot;<span class="string"> not found.</span>&quot;);
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is of the required type.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="discardWhiteSpace">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the required type.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the buffer is empty.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name" id="expectTypedEvent">expectTypedEvent</span>
+                                    (<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">if</span> (discardWhiteSpace) {
+            <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == <span class="reference">XMLEvent</span>.<span class="type">CHARACTERS</span>
+                   &amp;&amp; ev.chars.trim().equals(&quot;&quot;)) {
+                pool.surrenderEvent(ev);
+                ev = getEvent();
+            }
+        }
+        <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == eventType) {
+            <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                        (XMLEvent.eventTypeName(eventType)
+                                           + &quot;<span class="string"> not found: end of buffer.</span>&quot;);
+        pushBack(ev);
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is of the required type and has the
+     * required &lt;tt&gt;QName&lt;/tt&gt;.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required element.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the required type.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectTypedEvent</span>
+                    (<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">String</span> <span class="variable-name">qName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">if</span> (discardWhiteSpace) {
+            <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == <span class="reference">XMLEvent</span>.<span class="type">CHARACTERS</span>
+                   &amp;&amp; ev.chars.trim().equals(&quot;&quot;)) {
+                pool.surrenderEvent(ev);
+                ev = getEvent();
+            }
+        }
+        <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == eventType &amp;&amp; ev.qName.equals(qName)) {
+            <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                        (XMLEvent.eventTypeName(eventType)
+                                           + &quot;<span class="string"> not found: end of buffer.</span>&quot;);
+        pushBack(ev);
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is of the required type and has the
+     * required URI index and local name.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">uriIndex</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; URI index.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required element.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the required type.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectTypedEvent</span>
+                            (<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">int</span> <span class="variable-name">uriIndex</span>,
+                                 <span class="type">String</span> <span class="variable-name">localName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">if</span> (discardWhiteSpace) {
+            <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == <span class="reference">XMLEvent</span>.<span class="type">CHARACTERS</span>
+                   &amp;&amp; ev.chars.trim().equals(&quot;&quot;)) {
+                pool.surrenderEvent(ev);
+                ev = getEvent();
+            }
+        }
+        <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>
+                &amp;&amp; ev.type == eventType
+                   &amp;&amp; ev.uriIndex == uriIndex
+                       &amp;&amp; ev.localName.equals(localName)) {
+            <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                        (XMLEvent.eventTypeName(eventType)
+                                           + &quot;<span class="string"> not found: end of buffer.</span>&quot;);
+        pushBack(ev);
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is of the required type and has the
+     * required FO type.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">eventType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; event type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; FO type.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an event of the required type.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectTypedEvent</span>
+                    (<span class="type">int</span> <span class="variable-name">eventType</span>, <span class="type">int</span> <span class="variable-name">foType</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">if</span> (discardWhiteSpace) {
+            <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == <span class="reference">XMLEvent</span>.<span class="type">CHARACTERS</span>
+                   &amp;&amp; ev.chars.trim().equals(&quot;&quot;)) {
+                pool.surrenderEvent(ev);
+                ev = getEvent();
+            }
+        }
+        <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == eventType &amp;&amp; ev.foType == foType) {
+            <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                        (XMLEvent.eventTypeName(eventType)
+                                           + &quot;<span class="string"> not found: end of buffer.</span>&quot;);
+        pushBack(ev);
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Get the next ENDDOCUMENT event from the buffer.  Discard any other
+     * events preceding the ENDDOCUMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDDOCUMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getEndDocument">getEndDocument</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant" id="ENDDOCUMENT">ENDDOCUMENT</span>);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDDOCUMENT.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDDOCUMENT event. If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectEndDocument">expectEndDocument</span>(<span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDDOCUMENT</span>, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next STARTELEMENT event from the buffer.  Discard any other
+     * events preceding the STARTELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getStartElement">getStartElement</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant" id="STARTELEMENT">STARTELEMENT</span>);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is a STARTELEMENT.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectStartElement">expectStartElement</span>(<span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next STARTELEMENT event with the given &lt;tt&gt;QName&lt;/tt&gt;
+     * from the buffer.  Discard any other events preceding the
+     * STARTELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required STARTELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">String</span> <span class="variable-name">qName</span>) <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, qName);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is a STARTELEMENT with the given
+     * &lt;tt&gt;QName&lt;/tt&gt;.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required STARTELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                (<span class="type">String</span> <span class="variable-name">qName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent
+                        (XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, qName, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next STARTELEMENT event with the given URI index and local name
+     * from the buffer.  Discard any other events preceding the
+     * STARTELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">uriIndex</span><span class="comment"> an &lt;tt&gt;int&lt;/tt&gt; with the index of the URI of the
+     * required URI
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required STARTELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">String</span> <span class="variable-name">localName</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, uriIndex, localName);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is a STARTELEMENT with the given
+     * URI index and local name.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">uriIndex</span><span class="comment"> an &lt;tt&gt;int&lt;/tt&gt; URI index.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required STARTELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                (<span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">String</span> <span class="variable-name">localName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent
+            (XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, uriIndex, localName, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * From the buffer get the next STARTELEMENT event from the fo: namespace
+     * with the given FO object type.
+     *  Discard any other events preceding the
+     * STARTELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; FO object type, as defined in
+     * &lt;tt&gt;FObjectNames&lt;/tt&gt;.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching STARTELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">int</span> <span class="variable-name">foType</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, foType);
+    }
+
+    <span class="comment">/**
+     * From the buffer return the next STARTELEMENT event from the fo:
+     * namespace with the given FO object type.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> - the &lt;tt&gt;int&lt;/tt&gt; FO object type, as defined in
+     * &lt;tt&gt;FObjectNames&lt;/tt&gt;.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching STARTELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                    (<span class="type">int</span> <span class="variable-name">foType</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent
+            (XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, foType, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get one of a list of possible STARTELEMENT events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="list">list</span><span class="comment"> a &lt;tt&gt;LinkedList&lt;/tt&gt; containing either &lt;tt&gt;String&lt;/tt&gt;s
+     * with the &lt;tt&gt;QName&lt;/tt&gt;, or &lt;tt&gt;UriLocalName&lt;/tt&gt;
+     * objects with the URI index and local name of one of the required
+     * STARTELEMENT events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">getStartElement</span>
+                                (<span class="type">LinkedList</span> <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">do</span> {
+            ev = expectStartElement(list, discardWhiteSpace);
+            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            <span class="comment">// The non-matching event has been pushed back.
+</span>            <span class="comment">// Get it and discard.  Note that if the first attempt to
+</span>            <span class="comment">// getEvent() returns null, the expectStartElement() calls
+</span>            <span class="comment">// return null.
+</span>            ev = getEvent();
+            pool.surrenderEvent(ev);
+        } <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span>);
+        <span class="comment">// Exit from this while loop is only by discovery of null event
+</span>        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (&quot;<span class="string">StartElement from list not found.</span>&quot;);
+    }
+
+    <span class="comment">/**
+     * Get one of a list of possible STARTELEMENT events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> a &lt;tt&gt;LinkedList&lt;/tt&gt; containing either &lt;tt&gt;String&lt;/tt&gt;s
+     * with the &lt;tt&gt;QName&lt;/tt&gt;, or &lt;tt&gt;UriLocalName&lt;/tt&gt;
+     * objects with the URI index and local name of one of the required
+     * STARTELEMENT events.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a STARTELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                (<span class="type">LinkedList</span> <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="type">Iterator</span> <span class="variable-name" id="elements">elements</span> = list.iterator();
+        <span class="keyword">while</span> (elements.hasNext()) {
+            <span class="type">Object</span> <span class="variable-name" id="o">o</span> = elements.next();
+            <span class="keyword">if</span> (o <span class="keyword">instanceof</span> <span class="type">String</span>) {
+                ev = expectStartElement((<span class="type">String</span>) o, discardWhiteSpace);
+                <span class="comment">// Found it!
+</span>                <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            } <span class="keyword">else</span> <span class="keyword">if</span> (o <span class="keyword">instanceof</span> <span class="type">UriLocalName</span>) {
+                ev = expectStartElement
+                        (((<span class="type">UriLocalName</span>) o).uriIndex,
+                         ((<span class="type">UriLocalName</span>) o).localName,
+                         discardWhiteSpace);
+                <span class="comment">// Found it!
+</span>                <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            } <span class="keyword">else</span> <span class="keyword">if</span> (o <span class="keyword">instanceof</span> <span class="type">Integer</span>) {
+                ev = expectStartElement(((<span class="type">Integer</span>)o).intValue(),
+                                        discardWhiteSpace);
+                <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            } <span class="keyword">else</span>
+                <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">FOPException</span>
+                        (&quot;<span class="string">Invalid list elements for getStartElement</span>&quot;);
+        }
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Get one of a array of possible STARTELEMENT events.  Scan and discard
+     * events until a STARTELEMENT event is found whose URI index and
+     * local name matches one of those in the argument
+     * &lt;tt&gt;UriLocalName[]&lt;/tt&gt; array.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> an array containing &lt;tt&gt;UriLocalName&lt;/tt&gt;
+     * objects with the URI index and local name of
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * STARTELEMENT events, one of which is required.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the next matching STARTELEMENT event from the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">getStartElement</span>
+                    (<span class="type">UriLocalName</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">do</span> {
+            ev = expectStartElement(list, discardWhiteSpace);
+            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            <span class="comment">// The non-matching event has been pushed back.
+</span>            <span class="comment">// Get it and discard.  Note that if the first attempt to
+</span>            <span class="comment">// getEvent() returns null, the expectStartElement() calls
+</span>            <span class="comment">// will throw a NoSuchElementException
+</span>            ev = getEvent();
+            pool.surrenderEvent(ev);
+        } <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span>);
+        <span class="comment">// Exit from this while loop is only by discovery of null event
+</span>        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (&quot;<span class="string">StartElement from list not found.</span>&quot;);
+    }
+
+    <span class="comment">/**
+     * Expect one of an array of possible STARTELEMENT events.  The next
+     * STARTELEMENT must have a URI index and local name which match
+     * an element of the argument &lt;tt&gt;UriLocalName[]&lt;/tt&gt; list.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> an &lt;tt&gt;UriLocalName[]&lt;/tt&gt; array containing the
+     * namespace Uri index and LocalName
+     * of possible events, one of which must be the next returned.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the matching STARTELEMENT event. If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                    (<span class="type">UriLocalName</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">for</span> (<span class="type">int</span> <span class="variable-name" id="i">i</span> = <span class="jde-java-font-lock-number">0</span>; i &lt; list.length; i++) {
+            ev = expectStartElement(list[i].uriIndex,
+                                    list[i].localName,
+                                    discardWhiteSpace);
+            <span class="comment">// Found it!
+</span>            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Get one of a array of possible STARTELEMENT events.  Scan and discard
+     * events until a STARTELEMENT event is found whose &lt;tt&gt;QName&lt;/tt&gt;
+     * matches one of those in the argument &lt;tt&gt;String[]&lt;/tt&gt; array.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> a &lt;tt&gt;String[]&lt;/tt&gt; array containing &lt;tt&gt;QName&lt;/tt&gt;s,
+     * one of which is required.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the next matching STARTELEMENT event from the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">String</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">do</span> {
+            ev = expectStartElement(list, discardWhiteSpace);
+            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            <span class="comment">// The non-matching event has been pushed back.
+</span>            <span class="comment">// Get it and discard.  Note that if the first attempt to
+</span>            <span class="comment">// getEvent() returns null, the expectStartElement() calls
+</span>            <span class="comment">// will throw a NoSuchElementException
+</span>            ev = getEvent();
+            pool.surrenderEvent(ev);
+        } <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span>);
+        <span class="comment">// Exit from this while loop is only by discovery of null event
+</span>        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (&quot;<span class="string">StartElement from array not found.</span>&quot;);
+    }
+
+    <span class="comment">/**
+     * Expect one of an array of possible STARTELEMENT events.  The next
+     * STARTELEMENT must have a &lt;tt&gt;QName&lt;/tt&gt; which matches an element
+     * of the argument &lt;tt&gt;String[]&lt;/tt&gt; list.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> a &lt;tt&gt;String[]&lt;/tt&gt; array containing &lt;tt&gt;QName&lt;/tt&gt;s
+     * of possible events, one of which must be the next returned.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the matching STARTELEMENT event.If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                    (<span class="type">String</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">for</span> (<span class="type">int</span> <span class="variable-name">i</span> = <span class="jde-java-font-lock-number">0</span>; i &lt; list.length; i++) {
+            ev = expectStartElement(list[i], discardWhiteSpace);
+            <span class="comment">// Found it!
+</span>            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Get one of a array of possible STARTELEMENT events.  Scan and discard
+     * events until a STARTELEMENT event is found which is in the fo:
+     * namespace and whose FO type matches one of those in the argument
+     * &lt;tt&gt;int&lt;/tt&gt; array.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> an &lt;tt&gt;int[]&lt;/tt&gt; array containing FO types
+     * one of which is required.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the next matching STARTELEMENT event from the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">int</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">do</span> {
+            ev = expectStartElement(list, discardWhiteSpace);
+            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+            <span class="comment">// The non-matching event has been pushed back.
+</span>            <span class="comment">// Get it and discard.  Note that if the first attempt to
+</span>            <span class="comment">// getEvent() returns null, the expectStartElement() calls
+</span>            <span class="comment">// will throw a NoSuchElementException
+</span>            ev = getEvent();
+            pool.surrenderEvent(ev);
+        } <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span>);
+        <span class="comment">// Exit from this while loop is only by discovery of null event
+</span>        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (&quot;<span class="string">StartElement from array not found.</span>&quot;);
+    }
+
+    <span class="comment">/**
+     * Expect one of an array of possible STARTELEMENT events.  The next
+     * STARTELEMENT must be in the fo: namespace, and must have an FO type
+     * which matches one of those in the argument &lt;tt&gt;int[]&lt;/tt&gt; list.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">list</span><span class="comment"> a &lt;tt&gt;int[]&lt;/tt&gt; array containing the FO types
+     * of possible events, one of which must be the next returned.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the matching STARTELEMENT event.If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                    (<span class="type">int</span>[] <span class="variable-name">list</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">for</span> (<span class="type">int</span> <span class="variable-name">i</span> = <span class="jde-java-font-lock-number">0</span>; i &lt; list.length; i++) {
+            ev = expectStartElement(list[i], discardWhiteSpace);
+            <span class="comment">// Found it!
+</span>            <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+        }
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+    <span class="comment">/**
+     * Get one of a &lt;tt&gt;BitSet&lt;/tt&gt; of possible STARTELEMENT events.  Scan
+     * and discard events until a STARTELEMENT event is found which is in
+     * the fo: namespace and whose FO type matches one of those in the
+     * argument &lt;tt&gt;BitSet&lt;/tt&gt;.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="set">set</span><span class="comment"> a &lt;tt&gt;BitSet&lt;/tt&gt; containing FO types one of which is
+     * required.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the next matching STARTELEMENT event from the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getStartElement</span>(<span class="type">BitSet</span> <span class="variable-name">set</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">do</span> {
+            <span class="keyword">try</span> {
+                ev = expectStartElement(set, discardWhiteSpace);
+                <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+                <span class="comment">// The non-matching event has been pushed back.
+</span>                <span class="comment">// Get it and discard.  Note that if the first attempt to
+</span>                <span class="comment">// getEvent() returns null, the expectStartElement() calls
+</span>                <span class="comment">// will throw a NoSuchElementException
+</span>                ev = getEvent();
+                pool.surrenderEvent(ev);
+            } <span class="keyword">catch</span>(<span class="type">UnexpectedStartElementException</span> <span class="variable-name">e</span>) {
+                ev = getEvent();
+                pool.surrenderEvent(ev);
+            }
+        } <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span>);
+        <span class="comment">// Exit from this while loop is only by discovery of null event
+</span>        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>
+                    (&quot;<span class="string">StartElement from BitSet not found.</span>&quot;);
+    }
+
+    <span class="comment">/**
+     * Expect one of an &lt;tt&gt;BitSet&lt;/tt&gt; of possible STARTELEMENT events.
+     * The next STARTELEMENT must be in the fo: namespace, and must have an
+     * FO type which matches one of those in the argument &lt;tt&gt;BitSet&lt;/tt&gt;.
+     * &lt;p&gt;TODO:&lt;br&gt;
+     * This method should be retro-fitted to list and array versions.
+     *
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">set</span><span class="comment"> a &lt;tt&gt;BitSet&lt;/tt&gt; containing the FO types
+     * of possible events, one of which must be the next returned.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the matching STARTELEMENT event.If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectStartElement</span>
+                                    (<span class="type">BitSet</span> <span class="variable-name">set</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        ev = expectTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">STARTELEMENT</span>, discardWhiteSpace);
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>) <span class="keyword">return</span> ev;
+
+        <span class="keyword">for</span> (<span class="type">int</span> <span class="variable-name">i</span> = set.nextSetBit(<span class="jde-java-font-lock-number">0</span>); i &gt;= <span class="jde-java-font-lock-number">0</span>; i = set.nextSetBit(++i)) {
+            <span class="keyword">if</span> (ev.foType == i)
+                <span class="keyword">return</span> ev; <span class="comment">// Found it!
+</span>        }
+        <span class="comment">// Not found - push the STARTELEMENT event back and throw an
+</span>        <span class="comment">// UnexpectedStartElementException
+</span>        pushBack(ev);
+        <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">UnexpectedStartElementException</span>
+                (&quot;<span class="string">Unexpected START element: </span>&quot; + ev.getQName());
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of %block; from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, including out-of-line flow
+     * objects which may occur except as descendents of out-of-line formatting
+     * objects.  White space is discarded.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent found. If any other events are encountered
+     * return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectBlock">expectBlock</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="keyword">return</span> expectStartElement
+                (FObjectSets.blockEntity, XMLEvent.<span class="jde-java-font-lock-constant" id="DISCARD_W_SPACE">DISCARD_W_SPACE</span>);
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of %block; from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, excluding out-of-line flow
+     * objects which may not occur as descendents of out-of-line formatting
+     * objects.  White space is discarded.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent found. If any other events are encountered
+     * return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectOutOfLineBlock">expectOutOfLineBlock</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="keyword">return</span> expectStartElement
+                (FObjectSets.outOfLineBlockSet, XMLEvent.<span class="jde-java-font-lock-constant">DISCARD_W_SPACE</span>);
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of (#PCDATA|%inline;) from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, including out-of-line flow
+     * objects which may occur except as descendents of out-of-line
+     * formatting objects.  White space is retained, and
+     * will appear as #PCDATA, i.e, as an instance of FoCharacters.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent found. If any other events are encountered
+     * return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectPcdataOrInline">expectPcdataOrInline</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = expectStartElement
+                (FObjectSets.normalPcdataInlineSet, XMLEvent.<span class="jde-java-font-lock-constant" id="RETAIN_W_SPACE">RETAIN_W_SPACE</span>);
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            ev = expectCharacters();
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of (#PCDATA|%inline;) from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, excluding out-of-line flow
+     * objects which may not occur as descendents of out-of-line formatting
+     * objects.  White space is retained, and
+     * will appear as #PCDATA, i.e, as an instance of FoCharacters.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent found. If any other events are encountered
+     * return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectOutOfLinePcdataOrInline">expectOutOfLinePcdataOrInline</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = expectStartElement
+                    (FObjectSets.inlineEntity, XMLEvent.<span class="jde-java-font-lock-constant">RETAIN_W_SPACE</span>);
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            ev = expectCharacters();
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of (#PCDATA|%inline;|%block;) from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, including out-of-line flow
+     * objects which may occur except as descendents of out-of-line
+     * formatting objects.  White space is retained, and
+     * will appear as #PCDATA, i.e, as an instance of FoCharacters.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent&lt;/tt&gt; found. If any other events are
+     * encountered return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectPcdataOrInlineOrBlock">expectPcdataOrInlineOrBlock</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = expectStartElement
+            (FObjectSets.normalPcdataBlockInlineSet, XMLEvent.<span class="jde-java-font-lock-constant">RETAIN_W_SPACE</span>);
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            ev = expectCharacters();
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Expect that the next element will be a STARTELEMENT for one of the
+     * flow objects which are members of (#PCDATA|%inline;|%block;) from
+     * &lt;b&gt;</span><span class="jde-java-font-lock-bold">6.2 Formatting Object Content</span><span class="comment">&lt;/b&gt;, excluding out-of-line flow
+     * objects which may not occur as descendents of out-of-line formatting
+     * objects.  White space is retained, and
+     * will appear as #PCDATA, i.e, as an instance of FoCharacters.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the &lt;tt&gt;FoXMLEvent&lt;/tt&gt; found. If any other events are
+     * encountered return &lt;tt&gt;null&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectOutOfLinePcdataOrInlineOrBlock">expectOutOfLinePcdataOrInlineOrBlock</span>()
+        <span class="keyword">throws</span> <span class="type">FOPException</span>, <span class="type">UnexpectedStartElementException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = expectStartElement
+            (FObjectSets.outOfLinePcdataBlockInlineSet,
+                                                     XMLEvent.<span class="jde-java-font-lock-constant">RETAIN_W_SPACE</span>);
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>)
+            ev = expectCharacters();
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event from the buffer.  Discard any other
+     * events preceding the ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getEndElement">getEndElement</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant" id="ENDELEMENT">ENDELEMENT</span>);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT event.  If the next
+     * event detected is not of the required type, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if ENDELEMENT is not the next
+     * event detected.  The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectEndElement">expectEndElement</span>(<span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+                <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event with the given &lt;tt&gt;QName&lt;/tt&gt;
+     * from the buffer.  Discard any other events preceding the
+     * ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required STARTELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getEndElement</span>(<span class="type">String</span> <span class="variable-name">qName</span>) <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, qName);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT with the given
+     * &lt;tt&gt;QName&lt;/tt&gt;.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">qName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the &lt;tt&gt;QName&lt;/tt&gt; of the
+     * required ENDELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT with the given qname.  If the next
+     * event detected is not an ENDELEMENT, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">expectEndElement</span>(<span class="type">String</span> <span class="variable-name">qName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, qName, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event with the given URI index and local name
+     * from the buffer.  Discard any other events preceding the
+     * ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">uriIndex</span><span class="comment"> an &lt;tt&gt;int&lt;/tt&gt; with the index of the URI of the
+     * required URI
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required ENDELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getEndElement</span>(<span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">String</span> <span class="variable-name">localName</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, uriIndex, localName);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT with the given
+     * URI index and local name.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">uriIndex</span><span class="comment"> an &lt;tt&gt;int&lt;/tt&gt; with the index of the URI of the
+     * required URI
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">localName</span><span class="comment"> a &lt;tt&gt;String&lt;/tt&gt; with the local name of the
+     * required ENDELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT event.
+     * If the next
+     * event detected is not an ENDELEMENT, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectEndElement</span>
+                (<span class="type">int</span> <span class="variable-name">uriIndex</span>, <span class="type">String</span> <span class="variable-name">localName</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent
+                (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, uriIndex, localName, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event with the given Fo type
+     * from the buffer.  Discard any other events preceding the
+     * ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> - the FO type of the required ENDELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getEndElement</span>(<span class="type">int</span> <span class="variable-name">foType</span>) <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, foType);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT with the given
+     * FO type.  If the next
+     * element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">foType</span><span class="comment"> - the FO type of the required ENDELEMENT
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT.  If the next
+     * event detected is not an ENDELEMENT, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">expectEndElement</span>(<span class="type">int</span> <span class="variable-name">foType</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">return</span> expectTypedEvent
+                            (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, foType, discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event, with the same URI index and local name
+     * as the &lt;tt&gt;FoXMLEvent&lt;/tt&gt; argument, from the buffer.
+     * Discard any other events preceding the ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="event">event</span><span class="comment"> an &lt;tt&gt;FoXMLEvent&lt;/tt&gt;.  Only the uriIndex and the
+     * localName from the event are used.  It is intended that the FoXMLEvent
+     * returned to the corresponding get/expectStartElement() call be used.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getEndElement</span>(<span class="type">FoXMLEvent</span> <span class="variable-name">event</span>) <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">if</span> (event.foType != FObjectNames.<span class="jde-java-font-lock-constant" id="NO_FO">NO_FO</span>)
+            <span class="keyword">return</span> getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.foType);
+        <span class="keyword">return</span> getTypedEvent
+                    (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.uriIndex, event.localName);
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT with the same
+     * URI index and local name as the &lt;tt&gt;FoXMLEvent argument&lt;/tt&gt;.  If the
+     * next element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">event</span><span class="comment"> an &lt;tt&gt;FoXMLEvent&lt;/tt&gt;.  Only the uriIndex and the
+     * localName from the event are used.  It is intended that the FoXMLEvent
+     * returned to the corresponding get/expectStartElement() call be used.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT event.  If the next
+     * event detected is not an ENDELEMENT, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectEndElement</span>
+                                (<span class="type">FoXMLEvent</span> <span class="variable-name">event</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="keyword">if</span> (event.foType != FObjectNames.<span class="jde-java-font-lock-constant">NO_FO</span>)
+            <span class="keyword">return</span> expectTypedEvent
+                    (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.foType, discardWhiteSpace);
+        <span class="keyword">return</span> expectTypedEvent
+                (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.uriIndex, event.localName,
+                                                         discardWhiteSpace);
+    }
+
+    <span class="comment">/**
+     * Get the next ENDELEMENT event, with the same URI index and local name
+     * as the &lt;tt&gt;FoXMLEvent&lt;/tt&gt; argument, from the buffer.
+     * Discard any other events preceding the ENDELEMENT event.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="discardEvent">discardEvent</span><span class="comment"> the argument event may be discarded.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">event</span><span class="comment"> an &lt;tt&gt;FoXMLEvent&lt;/tt&gt;.  Only the uriIndex and the
+     * localName from the event are used.  It is intended that the FoXMLEvent
+     * returned to the corresponding get/expectStartElement() call be used.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> an ENDELEMENT event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name">getEndElement</span>(<span class="type">boolean</span> <span class="variable-name">discardEvent</span>, <span class="type">FoXMLEvent</span> <span class="variable-name">event</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">if</span> (event.foType != FObjectNames.<span class="jde-java-font-lock-constant">NO_FO</span>)
+            ev = getTypedEvent(XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.foType);
+        <span class="keyword">else</span>
+            ev = getTypedEvent
+                    (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.uriIndex, event.localName);
+        <span class="keyword">if</span> (discardEvent) {
+            <span class="comment">//System.out.println(&quot;discardEvent&quot;);
+</span>            pool.surrenderEvent(event);
+        }
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * Return the next element if it is an ENDELEMENT with the same
+     * URI index and local name as the &lt;tt&gt;FoXMLEvent argument&lt;/tt&gt;.  If the
+     * next element is not of the required type, push it back onto the buffer.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardEvent</span><span class="comment"> the argument event may be discarded.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">event</span><span class="comment"> an &lt;tt&gt;FoXMLEvent&lt;/tt&gt;.  Only the uriIndex and the
+     * localName from the event are used.  It is intended that the FoXMLEvent
+     * returned to the corresponding get/expectStartElement() call be used.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name">discardWhiteSpace</span><span class="comment"> - if true, discard any &lt;tt&gt;characters&lt;/tt&gt;
+     * events which contain only whitespace.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a matching ENDELEMENT event.  If the next
+     * event detected is not an ENDELEMENT, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="variable-name">expectEndElement</span>
+        (<span class="type">boolean</span> <span class="variable-name">discardEvent</span>, <span class="type">FoXMLEvent</span> <span class="variable-name">event</span>, <span class="type">boolean</span> <span class="variable-name">discardWhiteSpace</span>)
+        <span class="keyword">throws</span> <span class="type">FOPException</span>
+    {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span>;
+        <span class="keyword">if</span> (event.foType != FObjectNames.<span class="jde-java-font-lock-constant">NO_FO</span>)
+            ev = expectTypedEvent
+                    (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.foType, discardWhiteSpace);
+        <span class="keyword">else</span>
+            ev = expectTypedEvent
+                (XMLEvent.<span class="jde-java-font-lock-constant">ENDELEMENT</span>, event.uriIndex, event.localName,
+                                                         discardWhiteSpace);
+        <span class="keyword">if</span> (discardEvent)
+            pool.surrenderEvent(event);
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a CHARACTERS event
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if the event is not found
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="getCharacters">getCharacters</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">while</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type != XMLEvent.<span class="jde-java-font-lock-constant">CHARACTERS</span>) {
+            pool.surrenderEvent(ev);
+            ev = getEvent();
+        }
+        <span class="keyword">if</span> (ev == <span class="jde-java-font-lock-constant">null</span>) {
+            <span class="keyword">throw</span> <span class="keyword">new</span> <span class="type">NoSuchElementException</span>(&quot;<span class="string">Characters not found.</span>&quot;);
+        }
+        <span class="keyword">return</span> ev;
+    }
+
+    <span class="comment">/**
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> a CHARACTERS event.  If the next event detected is not
+     * a CHARACTERS event, &lt;tt&gt;null&lt;/tt&gt; is returned.
+     * The erroneous event is pushed back.
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">FOPException</span><span class="comment"> if buffer errors or interrupts occur
+     * </span><span class="jde-java-font-lock-doc-tag">@exception</span><span class="comment"> </span><span class="type">NoSuchElementException</span><span class="comment"> if end of buffer detected.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">FoXMLEvent</span> <span class="function-name" id="expectCharacters">expectCharacters</span>() <span class="keyword">throws</span> <span class="type">FOPException</span> {
+        <span class="type">FoXMLEvent</span> <span class="variable-name">ev</span> = getEvent();
+        <span class="keyword">if</span> (ev != <span class="jde-java-font-lock-constant">null</span> &amp;&amp; ev.type == XMLEvent.<span class="jde-java-font-lock-constant">CHARACTERS</span>) {
+            <span class="keyword">return</span> ev;
+        }
+        pushBack(ev);
+        <span class="keyword">return</span> <span class="jde-java-font-lock-constant">null</span>;
+    }
+
+}
+</pre>
+  </body>
+</html>
diff --git a/src/documentation/content/design/alt.design/XMLNamespaces.html b/src/documentation/content/design/alt.design/XMLNamespaces.html
new file mode 100644 (file)
index 0000000..5dc7fd1
--- /dev/null
@@ -0,0 +1,220 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!-- Created by htmlize-0.67 in css mode. -->
+<html>
+  <head>
+    <title>XMLNamespaces.java</title>
+    <style type="text/css">
+    <!--
+      body {
+        color: #000000;
+        background-color: #faf0e6;
+      } /* default */
+      .jde-java-font-lock-modifier {
+        color: #da70d6;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-modifier-face */
+      .comment {
+        color: #00008b;
+        background-color: #faf0e6;
+      } /* font-lock-comment-face */
+      .function-name {
+        color: #8b2323;
+        background-color: #faf0e6;
+      } /* font-lock-function-name-face */
+      .jde-java-font-lock-package {
+        color: #0000cd;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-package-face */
+      .jde-java-font-lock-constant {
+        color: #5f9ea0;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-constant-face */
+      .keyword {
+        color: #8b0000;
+        background-color: #faf0e6;
+      } /* font-lock-keyword-face */
+      .jde-java-font-lock-doc-tag {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-doc-tag-face */
+      .jde-java-font-lock-number {
+        color: #bc8f8f;
+        background-color: #faf0e6;
+      } /* jde-java-font-lock-number-face */
+      .string {
+        color: #008b00;
+        background-color: #faf0e6;
+      } /* font-lock-string-face */
+      .variable-name {
+        color: #8b008b;
+        background-color: #faf0e6;
+      } /* font-lock-variable-name-face */
+      .jde-java-font-lock-italic {
+        background-color: #faf0e6;
+        font-style: italic;
+      } /* jde-java-font-lock-italic-face */
+      .type {
+        color: #4682b4;
+        background-color: #faf0e6;
+      } /* font-lock-type-face */
+      a {
+        color: inherit;
+        background-color: inherit;
+        font: inherit;
+        text-decoration: inherit;
+      }
+      a:hover {
+        text-decoration: underline;
+      }
+    -->
+    </style>
+  </head>
+  <body>
+    <pre>
+<span class="keyword">package</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">xml</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">org</span>.<span class="jde-java-font-lock-package">apache</span>.<span class="jde-java-font-lock-package">fop</span>.<span class="jde-java-font-lock-package">datatypes</span>.<span class="type">Ints</span>;
+
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">HashMap</span>;
+<span class="keyword">import</span> <span class="jde-java-font-lock-package">java</span>.<span class="jde-java-font-lock-package">util</span>.<span class="type">ArrayList</span>;
+
+<span class="comment">/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ * @author &lt;a href=&quot;mailto:pbwest@powerup.com.au&quot;&gt;Peter B. West&lt;/a&gt;
+ * @version $Revision$ $Name$
+ */</span>
+<span class="comment">/**
+ * Maintains the namespaces encountered by an invocation of
+ * &lt;tt&gt;XMLSerialHandler&lt;/tt&gt;.
+ * &lt;p&gt;One instance of &lt;i&gt;</span><span class="jde-java-font-lock-italic">XMLNamespaces</span><span class="comment">&lt;/i&gt; is maintained across all
+ * documents that may be processed in a single invocation of
+ * &lt;tt&gt;XMLSerialhandler&lt;/tt&gt;.  A reference to that instance is kept with
+ * every instance of &lt;tt&gt;XMLEvent&lt;/tt&gt;.
+ */</span>
+
+<span class="jde-java-font-lock-modifier">public</span> <span class="keyword">class</span> <span class="function-name" id="XMLNamespacesClass">XMLNamespaces</span> {
+
+    <span class="jde-java-font-lock-modifier">private</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="tag">tag</span> = &quot;<span class="string">$Name$</span>&quot;;
+    <span class="jde-java-font-lock-modifier">private</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="revision">revision</span> = &quot;<span class="string">$Revision$</span>&quot;;
+
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="DefAttrNSpace">DefAttrNSpace</span> = &quot;&quot;;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="XSLNamespace">XSLNamespace</span> =
+        &quot;<span class="string">http://www.w3.org/1999/XSL/Format</span>&quot;;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="SVGNamespace">SVGNamespace</span> = &quot;<span class="string">http://www.w3.org/2000/svg</span>&quot;;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">String</span> <span class="variable-name" id="XlinkNamespace">XlinkNamespace</span> =
+        &quot;<span class="string">http://www.w3.org/1999/xlink</span>&quot;;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">int</span> <span class="variable-name" id="DefAttrNSIndex">DefAttrNSIndex</span> = <span class="jde-java-font-lock-number">0</span>;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">int</span> <span class="variable-name" id="XSLNSpaceIndex">XSLNSpaceIndex</span> = <span class="jde-java-font-lock-number">1</span>;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">int</span> <span class="variable-name" id="SVGNSpaceIndex">SVGNSpaceIndex</span> = <span class="jde-java-font-lock-number">2</span>;
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">static</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">int</span> <span class="variable-name" id="XLinkNSpaceIndex">XLinkNSpaceIndex</span> = <span class="jde-java-font-lock-number">3</span>;
+
+    <span class="comment">/**
+     * A &lt;tt&gt;HashMap&lt;/tt&gt; mapping a namespace URI to an &lt;tt&gt;int&lt;/tt&gt;
+     * index.  The HashMap is initialized with a few well-known URIs.  As
+     * URIs are encountered in parsing, they are converted to an integer
+     * index by lookup in this HashMap.  If the URI has not been seen, it
+     * is added to the &lt;i&gt;</span><span class="jde-java-font-lock-italic">uriIndices&lt;/i&gt; and &lt;i&gt;uris</span><span class="comment">&lt;/i&gt; for future reference.
+     * &lt;b&gt;It is vital that no URI, once added, ever be deleted
+     * from this &lt;tt&gt;HashMap&lt;/tt&gt;&lt;/b&gt;.
+     * &lt;p&gt;&lt;tt&gt;HashMap&lt;/&gt; is unsynchronized, so accesses and updates must be
+     * protected.
+     * &lt;p&gt;
+     * Updates will be very rare, and accesses are directly related to the
+     * number of elements (and attributes) encountered.
+     */</span>
+    <span class="jde-java-font-lock-modifier">private</span> <span class="type">HashMap</span> <span class="variable-name" id="uriIndices">uriIndices</span>;
+    <span class="comment">/**
+     * A &lt;tt&gt;ArrayList&lt;/tt&gt; of namespace URIs.  Effectively, a mapping of
+     * an &lt;tt&gt;int&lt;/tt&gt; index onto a URI.
+     * ArrayList is initialized with a few well-known URIs.  As
+     * URIs are encountered in parsing, they are converted to an integer
+     * index by lookup in the &lt;i&gt;</span><span class="jde-java-font-lock-italic">uriIndices</span><span class="comment">&lt;/i&gt; Hashmap. If the URI has not
+     * been seen, it is added to &lt;i&gt;</span><span class="jde-java-font-lock-italic">uriIndices&lt;/i&gt; and &lt;i&gt;uris</span><span class="comment">&lt;/i&gt;
+     * for future reference.
+     * &lt;p&gt;
+     * &lt;tt&gt;ArrayList&lt;/&gt; is unsynchronized, so access and updates must be
+     * protected.  Both will be more rare than accesses to &lt;i&gt;</span><span class="jde-java-font-lock-italic">uriIndices</span><span class="comment">&lt;/i&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">private</span> <span class="type">ArrayList</span> <span class="variable-name" id="uris">uris</span>;
+
+    <span class="comment">/**
+     * A sequence object for use by &lt;tt&gt;XMLEvent&lt;/tt&gt;s.  Because an
+     * &lt;tt&gt;XMLEvent&lt;/tt&gt; object must always be associated with an
+     * &lt;i&gt;</span><span class="jde-java-font-lock-italic">XMLNamespace</span><span class="comment">&lt;/i&gt; object, this namespace object will act as a
+     * singleton for &lt;tt&gt;XMLEvent&lt;/tt&gt;s.  This field provides a
+     * counter for those objects.  The range of values which may be
+     * assigned to &lt;i&gt;</span><span class="jde-java-font-lock-italic">sequence&lt;/i&gt; is restricted by &lt;i&gt;seqMask</span><span class="comment">&lt;/i&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">private</span> <span class="type">int</span> <span class="variable-name" id="sequence">sequence</span> = <span class="jde-java-font-lock-number">0</span>;
+
+    <span class="comment">/** Mask to restrict the range of values within which &lt;i&gt;</span><span class="jde-java-font-lock-italic">sequence</span><span class="comment">&lt;/i&gt;
+     * may cycle.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">final</span> <span class="type">int</span> <span class="variable-name" id="seqMask">seqMask</span> = (<span class="jde-java-font-lock-number">1</span> &lt;&lt; <span class="jde-java-font-lock-number">20</span>) - <span class="jde-java-font-lock-number">1</span>;
+
+    <span class="comment">/**
+     * The access function for the sequence.
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the next positive sequence number.  This number may wrap
+     * but is guaranteed to be within the range seqMask &gt;= sequence &gt;= 0.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="type">int</span> <span class="function-name" id="getSequence">getSequence</span>() {
+        sequence = ++sequence &amp; seqMask;
+        <span class="keyword">return</span> sequence;
+    }
+
+    <span class="jde-java-font-lock-modifier">public</span> <span class="function-name" id="XMLNamespaces">XMLNamespaces</span>() {
+        uriIndices = <span class="keyword">new</span> <span class="type">HashMap</span>(<span class="jde-java-font-lock-number">4</span>);
+        uris = <span class="keyword">new</span> <span class="type">ArrayList</span>(<span class="jde-java-font-lock-number">4</span>);
+        uriIndices.put(DefAttrNSpace, Ints.consts.get(DefAttrNSIndex));
+        uris.add(DefAttrNSIndex, DefAttrNSpace);
+        uriIndices.put(XSLNamespace, Ints.consts.get(XSLNSpaceIndex));
+        uris.add(XSLNSpaceIndex, XSLNamespace);
+        uriIndices.put(SVGNamespace, Ints.consts.get(SVGNSpaceIndex));
+        uris.add(SVGNSpaceIndex, SVGNamespace);
+        uriIndices.put(XlinkNamespace, Ints.consts.get(XLinkNSpaceIndex));
+        uris.add(XLinkNSpaceIndex, XlinkNamespace);
+    }
+
+    <span class="comment">/**
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> size of the &lt;tt&gt;uris&lt;/tt&gt; &lt;ttArrayList&lt;/tt&gt;.
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">synchronized</span> <span class="type">int</span> <span class="function-name" id="getUrisSize">getUrisSize</span>() {
+        <span class="keyword">return</span> uris.size();
+    }
+
+    <span class="comment">/**
+     * If the URI is not pre-defined, and has not been seen before, add
+     * it to the stored namespaces, and return the index.
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="uri">uri</span><span class="comment"> the namespace uri
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> integer index of the namespace URI
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">synchronized</span> <span class="type">int</span> <span class="function-name" id="getURIIndex">getURIIndex</span>(<span class="type">String</span> <span class="variable-name">uri</span>) {
+        <span class="type">int</span> <span class="variable-name" id="i">i</span>;
+        <span class="type">Integer</span> <span class="variable-name" id="intg">intg</span> = (<span class="type">Integer</span>)uriIndices.get(uri);
+        <span class="keyword">if</span> (intg == <span class="jde-java-font-lock-constant" id="null">null</span>) {
+            <span class="comment">// update the indices
+</span>            i = uris.size();
+            <span class="comment">//System.out.println(&quot;****Adding namespace &quot; + uri + &quot; &quot; + i);
+</span>            uriIndices.put(uri, Ints.consts.get(i));
+            uris.add(i, uri);
+            <span class="keyword">return</span> i;
+        }
+        <span class="comment">// not null - found the integer
+</span>        <span class="keyword">return</span> intg.intValue();
+    }
+
+    <span class="comment">/**
+     * </span><span class="jde-java-font-lock-doc-tag">@param</span><span class="comment"> </span><span class="variable-name" id="index">index</span><span class="comment"> the integer index of the namespace URI
+     * </span><span class="jde-java-font-lock-doc-tag">@return</span><span class="comment"> the corresponding namespace URI
+     */</span>
+    <span class="jde-java-font-lock-modifier">public</span> <span class="jde-java-font-lock-modifier">synchronized</span> <span class="type">String</span> <span class="function-name" id="getIndexURI">getIndexURI</span>(<span class="type">int</span> <span class="variable-name">index</span>) {
+        <span class="keyword">return</span> (<span class="type">String</span>)uris.get(index);
+    }
+
+}
+</pre>
+  </body>
+</html>