19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file
49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information
59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file
69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License.
89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at
99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software
139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and
169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License.
179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: ToTextStream.java 468654 2006-10-28 07:09:23Z minchau $
209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xml.serializer;
229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport java.io.IOException;
249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.serializer.utils.MsgKey;
269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.serializer.utils.Utils;
279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.xml.sax.Attributes;
289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.xml.sax.SAXException;
299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/**
319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This class is not a public API.
329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * It is only public because it is used in other packages.
339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This class converts SAX or SAX-like calls to a
349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * serialized document for xsl:output method of "text".
359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @xsl.usage internal
369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic class ToTextStream extends ToStream
389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{
399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Default constructor.
439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public ToTextStream()
459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    super();
479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of the beginning of a document.
539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The SAX parser will invoke this method only once, before any
559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * other methods in this interface or in DTDHandler (except for
569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * setDocumentLocator).</p>
579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  protected void startDocumentInternal() throws org.xml.sax.SAXException
649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    super.startDocumentInternal();
669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    m_needToCallStartDocument = false;
689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // No action for the moment.
709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of the end of a document.
749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The SAX parser will invoke this method only once, and it will
769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * be the last method invoked during the parse.  The parser shall
779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * not invoke this method until it has either abandoned parsing
789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * (because of an unrecoverable error) or reached the end of
799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * input.</p>
809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void endDocument() throws org.xml.sax.SAXException
879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    flushPending();
899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    flushWriter();
909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (m_tracer != null)
919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        super.fireEndDoc();
929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of the beginning of an element.
969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The Parser will invoke this method at the beginning of every
989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * element in the XML document; there will be a corresponding
999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * endElement() event for every startElement() event (even when the
1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * element is empty). All of the element's content will be
1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * reported, in order, before the corresponding endElement()
1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * event.</p>
1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>If the element name has a namespace prefix, the prefix will
1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * still be attached.  Note that the attribute list provided will
1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * contain only attributes with explicit values (specified or
1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * defaulted): #IMPLIED attributes will be omitted.</p>
1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param namespaceURI The Namespace URI, or the empty string if the
1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        element has no Namespace URI or if Namespace
1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        processing is not being performed.
1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param localName The local name (without prefix), or the
1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        empty string if Namespace processing is not being
1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        performed.
1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param name The qualified name (with prefix), or the
1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        empty string if qualified names are not available.
1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param atts The attributes attached to the element, if any.
1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see #endElement
1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see org.xml.sax.AttributeList
1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void startElement(
1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          String namespaceURI, String localName, String name, Attributes atts)
1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            throws org.xml.sax.SAXException
1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // time to fire off startElement event
1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (m_tracer != null) {
1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        super.fireStartElem(name);
1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        this.firePseudoAttributes();
1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    return;
1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of the end of an element.
1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The SAX parser will invoke this method at the end of every
1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * element in the XML document; there will be a corresponding
1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * startElement() event for every endElement() event (even when the
1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * element is empty).</p>
1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>If the element name has a namespace prefix, the prefix will
1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * still be attached to the name.</p>
1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param namespaceURI The Namespace URI, or the empty string if the
1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        element has no Namespace URI or if Namespace
1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        processing is not being performed.
1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param localName The local name (without prefix), or the
1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        empty string if Namespace processing is not being
1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        performed.
1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param name The qualified name (with prefix), or the
1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        empty string if qualified names are not available.
1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void endElement(String namespaceURI, String localName, String name)
1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null)
1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireEndElem(name);
1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of character data.
1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The Parser will call this method to report each chunk of
1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * character data.  SAX parsers may return all contiguous character
1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * data in a single chunk, or they may split it into several
1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * chunks; however, all of the characters in any single event
1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * must come from the same external entity, so that the Locator
1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * provides useful information.</p>
1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The application must not attempt to read from the array
1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * outside of the specified range.</p>
1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>Note that some parsers will report whitespace using the
1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * ignorableWhitespace() method rather than this one (validating
1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * parsers must do so).</p>
1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch The characters from the XML document.
1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param start The start position in the array.
1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param length The number of characters to read from the array.
1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see #ignorableWhitespace
1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see org.xml.sax.Locator
1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void characters(char ch[], int start, int length)
1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    flushPending();
2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    try
2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (inTemporaryOutputState()) {
2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            /* leave characters un-processed as we are
2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * creating temporary output, the output generated by
2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * this serializer will be input to a final serializer
2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * later on and it will do the processing in final
2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * output state (not temporary output state).
2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             *
2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * A "temporary" ToTextStream serializer is used to
2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * evaluate attribute value templates (for example),
2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * and the result of evaluating such a thing
2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             * is fed into a final serializer later on.
2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson             */
2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            m_writer.write(ch, start, length);
2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        }
2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        else {
2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            // In final output state we do process the characters!
2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            writeNormalizedChars(ch, start, length, m_lineSepUse);
2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        }
2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null)
2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireCharEvent(ch, start, length);
2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
2259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    catch(IOException ioe)
2269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
2279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      throw new SAXException(ioe);
2289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
2299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
2309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
2329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * If available, when the disable-output-escaping attribute is used,
2339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * output raw text without escaping.
2349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch The characters from the XML document.
2369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param start The start position in the array.
2379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param length The number of characters to read from the array.
2389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
2399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
2409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
2419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
2429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void charactersRaw(char ch[], int start, int length)
2439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
2449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
2459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    try
2479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
2489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      writeNormalizedChars(ch, start, length, m_lineSepUse);
2499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
2509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    catch(IOException ioe)
2519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
2529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      throw new SAXException(ioe);
2539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
2549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
2559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Normalize the characters, but don't escape.  Different from
2589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * SerializerToXML#writeNormalizedChars because it does not attempt to do
2599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * XML escaping at all.
2609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
2619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param ch The characters from the XML document.
2629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param start The start position in the array.
2639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param length The number of characters to read from the array.
2649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param useLineSep true if the operating systems
2659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * end-of-line separator should be output rather than a new-line character.
2669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
2679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws IOException
2689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws org.xml.sax.SAXException
2699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    void writeNormalizedChars(
2719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final char ch[],
2729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            final int start,
2739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            final int length,
2749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            final boolean useLineSep)
2759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            throws IOException, org.xml.sax.SAXException
2769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
2779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final String encoding = getEncoding();
2789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final java.io.Writer writer = m_writer;
2799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final int end = start + length;
2809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        /* copy a few "constants" before the loop for performance */
2829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final char S_LINEFEED = CharInfo.S_LINEFEED;
2839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // This for() loop always increments i by one at the end
2859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // of the loop.  Additional increments of i adjust for when
2869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // two input characters (a high/low UTF16 surrogate pair)
2879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // are processed.
2889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        for (int i = start; i < end; i++) {
2899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            final char c = ch[i];
2909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            if (S_LINEFEED == c && useLineSep) {
2929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                writer.write(m_lineSep, 0, m_lineSepLen);
2939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // one input char processed
2949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            } else if (m_encodingInfo.isInEncoding(c)) {
2959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                writer.write(c);
2969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // one input char processed
2979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            } else if (Encodings.isHighUTF16Surrogate(c)) {
2989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                final int codePoint = writeUTF16Surrogate(c, ch, i, end);
2999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                if (codePoint != 0) {
3009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    // I think we can just emit the message,
3019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    // not crash and burn.
3029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    final String integralValue = Integer.toString(codePoint);
3039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    final String msg = Utils.messages.createMessage(
3049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                        MsgKey.ER_ILLEGAL_CHARACTER,
3059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                        new Object[] { integralValue, encoding });
3069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //Older behavior was to throw the message,
3089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //but newer gentler behavior is to write a message to System.err
3099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //throw new SAXException(msg);
3109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    System.err.println(msg);
3119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                }
3139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                i++; // two input chars processed
3149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            } else {
3159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // Don't know what to do with this char, it is
3169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // not in the encoding and not a high char in
3179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // a surrogate pair, so write out as an entity ref
3189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                if (encoding != null) {
3199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    /* The output encoding is known,
3209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                     * so somthing is wrong.
3219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                     */
3229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    // not in the encoding, so write out a character reference
3249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    writer.write('&');
3259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    writer.write('#');
3269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    writer.write(Integer.toString(c));
3279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    writer.write(';');
3289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    // I think we can just emit the message,
3309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    // not crash and burn.
3319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    final String integralValue = Integer.toString(c);
3329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    final String msg = Utils.messages.createMessage(
3339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                        MsgKey.ER_ILLEGAL_CHARACTER,
3349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                        new Object[] { integralValue, encoding });
3359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //Older behavior was to throw the message,
3379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //but newer gentler behavior is to write a message to System.err
3389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    //throw new SAXException(msg);
3399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    System.err.println(msg);
3409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                } else {
3419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    /* The output encoding is not known,
3429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                     * so just write it out as-is.
3439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                     */
3449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                    writer.write(c);
3459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                }
3469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                // one input char was processed
3489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            }
3499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        }
3509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
3519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of cdata.
3549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The Parser will call this method to report each chunk of
3569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * character data.  SAX parsers may return all contiguous character
3579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * data in a single chunk, or they may split it into several
3589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * chunks; however, all of the characters in any single event
3599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * must come from the same external entity, so that the Locator
3609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * provides useful information.</p>
3619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The application must not attempt to read from the array
3639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * outside of the specified range.</p>
3649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>Note that some parsers will report whitespace using the
3669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * ignorableWhitespace() method rather than this one (validating
3679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * parsers must do so).</p>
3689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch The characters from the XML document.
3709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param start The start position in the array.
3719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param length The number of characters to read from the array.
3729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
3739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
3749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see #ignorableWhitespace
3759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see org.xml.sax.Locator
3769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
3779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void cdata(char ch[], int start, int length)
3789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
3799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
3809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    try
3819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
3829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        writeNormalizedChars(ch, start, length, m_lineSepUse);
3839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null)
3849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireCDATAEvent(ch, start, length);
3859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
3869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    catch(IOException ioe)
3879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
3889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      throw new SAXException(ioe);
3899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
3909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
3919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
3929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
3939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of ignorable whitespace in element content.
3949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
3959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>Validating Parsers must use this method to report each chunk
3969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * of ignorable whitespace (see the W3C XML 1.0 recommendation,
3979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * section 2.10): non-validating parsers may also use this method
3989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * if they are capable of parsing and using content models.</p>
3999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>SAX parsers may return all contiguous whitespace in a single
4019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * chunk, or they may split it into several chunks; however, all of
4029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * the characters in any single event must come from the same
4039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * external entity, so that the Locator provides useful
4049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * information.</p>
4059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The application must not attempt to read from the array
4079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * outside of the specified range.</p>
4089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch The characters from the XML document.
4109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param start The start position in the array.
4119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param length The number of characters to read from the array.
4129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
4139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
4149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see #characters
4159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
4179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void ignorableWhitespace(char ch[], int start, int length)
4199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
4209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
4219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    try
4239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
4249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      writeNormalizedChars(ch, start, length, m_lineSepUse);
4259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
4269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    catch(IOException ioe)
4279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
4289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      throw new SAXException(ioe);
4299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
4309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
4319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notification of a processing instruction.
4349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>The Parser will invoke this method once for each processing
4369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * instruction found: note that processing instructions may occur
4379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * before or after the main document element.</p>
4389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * <p>A SAX parser should never report an XML declaration (XML 1.0,
4409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
4419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * using this method.</p>
4429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param target The processing instruction target.
4449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param data The processing instruction data, or null if
4459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *        none was supplied.
4469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
4479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
4489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
4509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void processingInstruction(String target, String data)
4529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
4539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
4549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // flush anything pending first
4559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    flushPending();
4569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (m_tracer != null)
4589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        super.fireEscapingEvent(target, data);
4599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
4609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Called when a Comment is to be constructed.
4639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Note that Xalan will normally invoke the other version of this method.
4649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * %REVIEW% In fact, is this one ever needed, or was it a mistake?
4659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param   data  The comment data.
4679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException Any SAX exception, possibly
4689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *            wrapping another exception.
4699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void comment(String data) throws org.xml.sax.SAXException
4719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
4729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      final int length = data.length();
4739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      if (length > m_charsBuff.length)
4749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      {
4759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          m_charsBuff = new char[length*2 + 1];
4769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      }
4779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      data.getChars(0, length, m_charsBuff, 0);
4789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      comment(m_charsBuff, 0, length);
4799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
4809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
4829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Report an XML comment anywhere in the document.
4839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This callback will be used for comments inside or outside the
4859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * document element, including comments in the external DTD
4869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * subset (if read).
4879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
4889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param ch An array holding the characters in the comment.
4899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param start The starting position in the array.
4909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param length The number of characters to use from the array.
4919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException The application may raise an exception.
4929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
4939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void comment(char ch[], int start, int length)
4949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          throws org.xml.sax.SAXException
4959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
4969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
4979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    flushPending();
4989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (m_tracer != null)
4999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        super.fireCommentEvent(ch, start, length);
5009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
5019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
5039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Receive notivication of a entityReference.
5049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param name non-null reference to the name of the entity.
5069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
5079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws org.xml.sax.SAXException
5089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
5099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void entityReference(String name) throws org.xml.sax.SAXException
5109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
5119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null)
5129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireEntityReference(name);
5139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
5149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @see ExtendedContentHandler#addAttribute(String, String, String, String, String)
5179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttribute(
5199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String uri,
5209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String localName,
5219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String rawName,
5229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String type,
5239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String value,
5249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        boolean XSLAttribute)
5259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // do nothing, just forget all about the attribute
5279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @see org.xml.sax.ext.LexicalHandler#endCDATA()
5319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void endCDATA() throws SAXException
5339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // do nothing
5359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @see ExtendedContentHandler#endElement(String)
5399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void endElement(String elemName) throws SAXException
5419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null)
5439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireEndElem(elemName);
5449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * From XSLTC
5489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void startElement(
5509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    String elementNamespaceURI,
5519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    String elementLocalName,
5529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    String elementName)
5539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    throws SAXException
5549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_needToCallStartDocument)
5569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            startDocumentInternal();
5579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // time to fire off startlement event.
5589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (m_tracer != null) {
5599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            super.fireStartElem(elementName);
5609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            this.firePseudoAttributes();
5619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        }
5629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        return;
5649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * From XSLTC
5699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void characters(String characters)
5719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    throws SAXException
5729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final int length = characters.length();
5749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        if (length > m_charsBuff.length)
5759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        {
5769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            m_charsBuff = new char[length*2 + 1];
5779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        }
5789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        characters.getChars(0, length, m_charsBuff, 0);
5799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        characters(m_charsBuff, 0, length);
5809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * From XSLTC
5859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttribute(String name, String value)
5879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // do nothing, forget about the attribute
5899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
5919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
5929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add a unique attribute
5939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
5949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addUniqueAttribute(String qName, String value, int flags)
5959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException
5969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
5979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // do nothing, forget about the attribute
5989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
5999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public boolean startPrefixMapping(
6019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String prefix,
6029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String uri,
6039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        boolean shouldFlush)
6049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException
6059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
6069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // no namespace support for HTML
6079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        return false;
6089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
6099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void startPrefixMapping(String prefix, String uri)
6129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws org.xml.sax.SAXException
6139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
6149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // no namespace support for HTML
6159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
6169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void namespaceAfterStartElement(
6199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final String prefix,
6209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        final String uri)
6219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException
6229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
6239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        // no namespace support for HTML
6249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
6259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
6269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void flushPending() throws org.xml.sax.SAXException
6279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
6289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            if (m_needToCallStartDocument)
6299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            {
6309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                startDocumentInternal();
6319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                m_needToCallStartDocument = false;
6329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            }
6339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
6349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson}
635