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: ExtendedContentHandler.java 468654 2006-10-28 07:09:23Z minchau $
209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xml.serializer;
229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.SourceLocator;
249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.xml.sax.SAXException;
269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/**
289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This interface describes extensions to the SAX ContentHandler interface.
299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * It is intended to be used by a serializer. The methods on this interface will
309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * implement SAX- like behavior. This allows the gradual collection of
319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * information rather than having it all up front. For example the call
329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <pre>
339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * startElement(namespaceURI,localName,qName,atts)
349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * </pre>
359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * could be replaced with the calls
369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <pre>
379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * startElement(namespaceURI,localName,qName)
389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * addAttributes(atts)
399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * </pre>
409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * If there are no attributes the second call can be dropped. If attributes are
419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to be added one at a time with calls to
429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <pre>
439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * addAttribute(namespaceURI, localName, qName, type, value)
449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * </pre>
459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @xsl.usage internal
469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic interface ExtendedContentHandler extends org.xml.sax.ContentHandler
489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{
499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add at attribute to the current element
519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI of the attribute name
529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param localName the local name of the attribute (without prefix)
539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param rawName the qualified name of the attribute
549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param type the attribute type typically character data (CDATA)
559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param value the value of the attribute
569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param XSLAttribute true if the added attribute is coming from an xsl:attribute element
579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttribute(
609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String uri,
619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String localName,
629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String rawName,
639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String type,
649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String value,
659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        boolean XSLAttribute)
669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException;
679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add attributes to the current element
699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param atts the attributes to add.
709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttributes(org.xml.sax.Attributes atts)
739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws org.xml.sax.SAXException;
749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add an attribute to the current element. The namespace URI of the
769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * attribute will be calculated from the prefix of qName. The local name
779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * will be derived from qName and the type will be assumed to be "CDATA".
789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param qName
799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param value
809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttribute(String qName, String value);
829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify of a character event, but passing the data
859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * as a character String rather than the standard character array.
869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param chars the character data
879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void characters(String chars) throws SAXException;
909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify of a character event, but passing the data
939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * as a DOM Node rather than the standard character array.
949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param node a DOM Node containing text.
959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException;
989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify that an element has ended. Unlike the
1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * standard SAX method
1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * <pre>
1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * endElement(namespaceURI,localName,qName)
1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * </pre>
1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * only the last parameter is passed. If needed the serializer can derive
1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * the localName from the qualified name and derive the namespaceURI from
1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * its implementation.
1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param elemName the fully qualified element name.
1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void endElement(String elemName) throws SAXException;
1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify that an element is starting.
1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is just like the standard SAX method
1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * <pre>
1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * startElement(uri,localName,qname,atts)
1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * </pre>
1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * but without the attributes.
1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI of the element
1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param localName the local name (without prefix) of the element
1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param qName the qualified name of the element
1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void startElement(String uri, String localName, String qName)
1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws org.xml.sax.SAXException;
1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify of the start of an element
1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param qName the fully qualified name of the element
1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void startElement(String qName) throws SAXException;
1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify that a prefix mapping is to start, but
1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * after an element is started. The SAX method call
1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * <pre>
1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * startPrefixMapping(prefix,uri)
1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * </pre>
1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * is used just before an element starts and applies to the element to come,
1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * not to the current element.  This method applies to the current element.
1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * For example one could make the calls in this order:
1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * <pre>
1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * startElement("prfx8:elem9")
1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * namespaceAfterStartElement("http://namespace8","prfx8")
1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * </pre>
1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI being declared
1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param prefix the prefix that maps to the given namespace
1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void namespaceAfterStartElement(String uri, String prefix)
1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException;
1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to notify that a prefix maping is to start, which can
1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * be for the current element, or for the one to come.
1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param prefix the prefix that maps to the given URI
1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI of the given prefix
1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param shouldFlush if true this call is like the SAX
1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * startPrefixMapping(prefix,uri) call and the mapping applies to the
1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * element to come.  If false the mapping applies to the current element.
1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @return boolean false if the prefix mapping was already in effect (in
1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * other words we are just re-declaring), true if this is a new, never
1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * before seen mapping for the element.
1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public boolean startPrefixMapping(
1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String prefix,
1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String uri,
1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        boolean shouldFlush)
1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException;
1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Notify of an entity reference.
1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param entityName the name of the entity
1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void entityReference(String entityName) throws SAXException;
1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method returns an object that has the current namespace mappings in
1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * effect.
1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @return NamespaceMappings an object that has the current namespace
1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * mappings in effect.
1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public NamespaceMappings getNamespaceMappings();
1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method returns the prefix that currently maps to the given namespace
1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * URI.
1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI
1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @return String the prefix that currently maps to the given URI.
1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public String getPrefix(String uri);
1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method gets the prefix associated with a current element or
1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * attribute name.
1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param name the qualified name of an element, or attribute
1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param isElement true if it is an element name, false if it is an
2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * atttribute name
2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @return String the namespace URI associated with the element or
2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * attribute.
2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public String getNamespaceURI(String name, boolean isElement);
2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method returns the namespace URI currently associated with the
2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * prefix.
2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param prefix a prefix of an element or attribute.
2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @return String the namespace URI currently associated with the prefix.
2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public String getNamespaceURIFromPrefix(String prefix);
2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * This method is used to set the source locator, which might be used to
2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * generated an error message.
2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param locator the source locator
2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void setSourceLocator(SourceLocator locator);
2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // Bit constants for addUniqueAttribute().
2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // The attribute value contains no bad characters. A "bad" character is one which
2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // is greater than 126 or it is one of '<', '>', '&' or '"'.
2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public static final int NO_BAD_CHARS = 0x1;
2259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // An HTML empty attribute (e.g. <OPTION selected>).
2279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public static final int HTML_ATTREMPTY = 0x2;
2289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // An HTML URL attribute
2309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public static final int HTML_ATTRURL = 0x4;
2319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add a unique attribute to the current element.
2349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * The attribute is guaranteed to be unique here. The serializer can write
2359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * it out immediately without saving it in a table first. The integer
2369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * flag contains information about the attribute, which helps the serializer
2379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * to decide whether a particular processing is needed.
2389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     *
2399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param qName the fully qualified attribute name.
2409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param value the attribute value
2419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param flags a bitwise flag
2429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addUniqueAttribute(String qName, String value, int flags)
2449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException;
2459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add an attribute from an xsl:attribute element.
2489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param qName the qualified attribute name (prefix:localName)
2499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param value the attributes value
2509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the uri that the prefix of the qName is mapped to.
2519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addXSLAttribute(String qName, final String value, final String uri);
2539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    /**
2559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * Add at attribute to the current element, not from an xsl:attribute
2569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * element.
2579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param uri the namespace URI of the attribute name
2589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param localName the local name of the attribute (without prefix)
2599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param rawName the qualified name of the attribute
2609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param type the attribute type typically character data (CDATA)
2619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @param value the value of the attribute
2629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     * @throws SAXException
2639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     */
2649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    public void addAttribute(
2659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String uri,
2669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String localName,
2679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String rawName,
2689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String type,
2699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        String value)
2709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        throws SAXException;
2719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson}
272