14c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
24c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
34c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * or more contributor license agreements. See the NOTICE file
44c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed with this work for additional information
54c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * regarding copyright ownership. The ASF licenses this file
64c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
74c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * you may not use this file except in compliance with the License.
84c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * You may obtain a copy of the License at
94c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Unless required by applicable law or agreed to in writing, software
134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * See the License for the specific language governing permissions and
164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * limitations under the License.
174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * $Id: ExtendedContentHandler.java 468654 2006-10-28 07:09:23Z minchau $
204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpackage org.apache.xml.serializer;
224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport javax.xml.transform.SourceLocator;
244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.xml.sax.SAXException;
264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/**
284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * This interface describes extensions to the SAX ContentHandler interface.
294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * It is intended to be used by a serializer. The methods on this interface will
304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * implement SAX- like behavior. This allows the gradual collection of
314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * information rather than having it all up front. For example the call
324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <pre>
334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * startElement(namespaceURI,localName,qName,atts)
344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * </pre>
354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * could be replaced with the calls
364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <pre>
374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * startElement(namespaceURI,localName,qName)
384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * addAttributes(atts)
394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * </pre>
404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * If there are no attributes the second call can be dropped. If attributes are
414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * to be added one at a time with calls to
424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <pre>
434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * addAttribute(namespaceURI, localName, qName, type, value)
444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * </pre>
454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @xsl.usage internal
464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpublic interface ExtendedContentHandler extends org.xml.sax.ContentHandler
484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson{
494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add at attribute to the current element
514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI of the attribute name
524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param localName the local name of the attribute (without prefix)
534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param rawName the qualified name of the attribute
544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param type the attribute type typically character data (CDATA)
554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param value the value of the attribute
564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param XSLAttribute true if the added attribute is coming from an xsl:attribute element
574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addAttribute(
604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String uri,
614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String localName,
624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String rawName,
634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String type,
644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String value,
654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        boolean XSLAttribute)
664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws SAXException;
674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add attributes to the current element
694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param atts the attributes to add.
704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
724c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addAttributes(org.xml.sax.Attributes atts)
734c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws org.xml.sax.SAXException;
744c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
754c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add an attribute to the current element. The namespace URI of the
764c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * attribute will be calculated from the prefix of qName. The local name
774c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * will be derived from qName and the type will be assumed to be "CDATA".
784c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param qName
794c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param value
804c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
814c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addAttribute(String qName, String value);
824c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
834c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
844c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify of a character event, but passing the data
854c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * as a character String rather than the standard character array.
864c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param chars the character data
874c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
884c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
894c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void characters(String chars) throws SAXException;
904c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
914c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
924c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify of a character event, but passing the data
934c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * as a DOM Node rather than the standard character array.
944c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param node a DOM Node containing text.
954c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
964c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
974c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException;
984c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
994c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify that an element has ended. Unlike the
1004c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * standard SAX method
1014c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * <pre>
1024c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * endElement(namespaceURI,localName,qName)
1034c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * </pre>
1044c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * only the last parameter is passed. If needed the serializer can derive
1054c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * the localName from the qualified name and derive the namespaceURI from
1064c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * its implementation.
1074c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param elemName the fully qualified element name.
1084c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1094c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void endElement(String elemName) throws SAXException;
1114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify that an element is starting.
1144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is just like the standard SAX method
1154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * <pre>
1164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * startElement(uri,localName,qname,atts)
1174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * </pre>
1184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * but without the attributes.
1194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI of the element
1204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param localName the local name (without prefix) of the element
1214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param qName the qualified name of the element
1224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     *
1234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void startElement(String uri, String localName, String qName)
1264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws org.xml.sax.SAXException;
1274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify of the start of an element
1304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param qName the fully qualified name of the element
1314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void startElement(String qName) throws SAXException;
1344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify that a prefix mapping is to start, but
1364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * after an element is started. The SAX method call
1374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * <pre>
1384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * startPrefixMapping(prefix,uri)
1394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * </pre>
1404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * is used just before an element starts and applies to the element to come,
1414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * not to the current element.  This method applies to the current element.
1424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * For example one could make the calls in this order:
1434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * <pre>
1444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * startElement("prfx8:elem9")
1454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * namespaceAfterStartElement("http://namespace8","prfx8")
1464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * </pre>
1474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     *
1484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI being declared
1494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param prefix the prefix that maps to the given namespace
1504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void namespaceAfterStartElement(String uri, String prefix)
1534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws SAXException;
1544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to notify that a prefix maping is to start, which can
1574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * be for the current element, or for the one to come.
1584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param prefix the prefix that maps to the given URI
1594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI of the given prefix
1604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param shouldFlush if true this call is like the SAX
1614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * startPrefixMapping(prefix,uri) call and the mapping applies to the
1624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * element to come.  If false the mapping applies to the current element.
1634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @return boolean false if the prefix mapping was already in effect (in
1644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * other words we are just re-declaring), true if this is a new, never
1654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * before seen mapping for the element.
1664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public boolean startPrefixMapping(
1694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String prefix,
1704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String uri,
1714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        boolean shouldFlush)
1724c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws SAXException;
1734c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1744c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Notify of an entity reference.
1754c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param entityName the name of the entity
1764c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
1774c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1784c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void entityReference(String entityName) throws SAXException;
1794c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1804c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1814c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method returns an object that has the current namespace mappings in
1824c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * effect.
1834c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     *
1844c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @return NamespaceMappings an object that has the current namespace
1854c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * mappings in effect.
1864c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1874c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public NamespaceMappings getNamespaceMappings();
1884c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1894c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method returns the prefix that currently maps to the given namespace
1904c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * URI.
1914c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI
1924c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @return String the prefix that currently maps to the given URI.
1934c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
1944c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public String getPrefix(String uri);
1954c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
1964c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method gets the prefix associated with a current element or
1974c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * attribute name.
1984c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param name the qualified name of an element, or attribute
1994c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param isElement true if it is an element name, false if it is an
2004c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * atttribute name
2014c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @return String the namespace URI associated with the element or
2024c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * attribute.
2034c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2044c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public String getNamespaceURI(String name, boolean isElement);
2054c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
2064c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method returns the namespace URI currently associated with the
2074c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * prefix.
2084c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param prefix a prefix of an element or attribute.
2094c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @return String the namespace URI currently associated with the prefix.
2104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public String getNamespaceURIFromPrefix(String prefix);
2124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
2144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * This method is used to set the source locator, which might be used to
2154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * generated an error message.
2164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param locator the source locator
2174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void setSourceLocator(SourceLocator locator);
2194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Bit constants for addUniqueAttribute().
2214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // The attribute value contains no bad characters. A "bad" character is one which
2234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // is greater than 126 or it is one of '<', '>', '&' or '"'.
2244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public static final int NO_BAD_CHARS = 0x1;
2254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // An HTML empty attribute (e.g. <OPTION selected>).
2274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public static final int HTML_ATTREMPTY = 0x2;
2284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // An HTML URL attribute
2304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public static final int HTML_ATTRURL = 0x4;
2314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
2334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add a unique attribute to the current element.
2344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * The attribute is guaranteed to be unique here. The serializer can write
2354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * it out immediately without saving it in a table first. The integer
2364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * flag contains information about the attribute, which helps the serializer
2374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * to decide whether a particular processing is needed.
2384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     *
2394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param qName the fully qualified attribute name.
2404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param value the attribute value
2414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param flags a bitwise flag
2424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addUniqueAttribute(String qName, String value, int flags)
2444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws SAXException;
2454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
2474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add an attribute from an xsl:attribute element.
2484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param qName the qualified attribute name (prefix:localName)
2494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param value the attributes value
2504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the uri that the prefix of the qName is mapped to.
2514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addXSLAttribute(String qName, final String value, final String uri);
2534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    /**
2554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * Add at attribute to the current element, not from an xsl:attribute
2564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * element.
2574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param uri the namespace URI of the attribute name
2584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param localName the local name of the attribute (without prefix)
2594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param rawName the qualified name of the attribute
2604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param type the attribute type typically character data (CDATA)
2614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @param value the value of the attribute
2624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     * @throws SAXException
2634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     */
2644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    public void addAttribute(
2654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String uri,
2664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String localName,
2674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String rawName,
2684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String type,
2694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        String value)
2704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        throws SAXException;
2714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson}
272