All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler Maven / Gradle / Ivy

The newest version!
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
 * or packager/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at packager/legal/LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 *
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * $Id: ExtendedContentHandler.java,v 1.8 2010-11-01 04:34:44 joehw Exp $
 */
package com.sun.org.apache.xml.internal.serializer;

import javax.xml.transform.SourceLocator;

import org.xml.sax.SAXException;

/**
 * This interface describes extensions to the SAX ContentHandler interface.
 * It is intended to be used by a serializer. The methods on this interface will
 * implement SAX- like behavior. This allows the gradual collection of
 * information rather than having it all up front. For example the call
 * 
 * startElement(namespaceURI,localName,qName,atts)
 * 
* could be replaced with the calls *
 * startElement(namespaceURI,localName,qName)
 * addAttributes(atts)
 * 
* If there are no attributes the second call can be dropped. If attributes are * to be added one at a time with calls to *
 * addAttribute(namespaceURI, localName, qName, type, value)
 * 
* @xsl.usage internal */ abstract interface ExtendedContentHandler extends org.xml.sax.ContentHandler { /** * Add at attribute to the current element * @param uri the namespace URI of the attribute name * @param localName the local name of the attribute (without prefix) * @param rawName the qualified name of the attribute * @param type the attribute type typically character data (CDATA) * @param value the value of the attribute * @param XSLAttribute true if the added attribute is coming from an xsl:attribute element * @throws SAXException */ public void addAttribute( String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException; /** * Add attributes to the current element * @param atts the attributes to add. * @throws SAXException */ public void addAttributes(org.xml.sax.Attributes atts) throws org.xml.sax.SAXException; /** * Add an attribute to the current element. The namespace URI of the * attribute will be calculated from the prefix of qName. The local name * will be derived from qName and the type will be assumed to be "CDATA". * @param qName * @param value */ public void addAttribute(String qName, String value); /** * This method is used to notify of a character event, but passing the data * as a character String rather than the standard character array. * @param chars the character data * @throws SAXException */ public void characters(String chars) throws SAXException; /** * This method is used to notify of a character event, but passing the data * as a DOM Node rather than the standard character array. * @param node a DOM Node containing text. * @throws SAXException */ public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException; /** * This method is used to notify that an element has ended. Unlike the * standard SAX method *
     * endElement(namespaceURI,localName,qName)
     * 
* only the last parameter is passed. If needed the serializer can derive * the localName from the qualified name and derive the namespaceURI from * its implementation. * @param elemName the fully qualified element name. * @throws SAXException */ public void endElement(String elemName) throws SAXException; /** * This method is used to notify that an element is starting. * This method is just like the standard SAX method *
     * startElement(uri,localName,qname,atts)
     * 
* but without the attributes. * @param uri the namespace URI of the element * @param localName the local name (without prefix) of the element * @param qName the qualified name of the element * * @throws SAXException */ public void startElement(String uri, String localName, String qName) throws org.xml.sax.SAXException; /** * This method is used to notify of the start of an element * @param qName the fully qualified name of the element * @throws SAXException */ public void startElement(String qName) throws SAXException; /** * This method is used to notify that a prefix mapping is to start, but * after an element is started. The SAX method call *
     * startPrefixMapping(prefix,uri)
     * 
* is used just before an element starts and applies to the element to come, * not to the current element. This method applies to the current element. * For example one could make the calls in this order: *
     * startElement("prfx8:elem9")
     * namespaceAfterStartElement("http://namespace8","prfx8")
     * 
* * @param uri the namespace URI being declared * @param prefix the prefix that maps to the given namespace * @throws SAXException */ public void namespaceAfterStartElement(String uri, String prefix) throws SAXException; /** * This method is used to notify that a prefix maping is to start, which can * be for the current element, or for the one to come. * @param prefix the prefix that maps to the given URI * @param uri the namespace URI of the given prefix * @param shouldFlush if true this call is like the SAX * startPrefixMapping(prefix,uri) call and the mapping applies to the * element to come. If false the mapping applies to the current element. * @return boolean false if the prefix mapping was already in effect (in * other words we are just re-declaring), true if this is a new, never * before seen mapping for the element. * @throws SAXException */ public boolean startPrefixMapping( String prefix, String uri, boolean shouldFlush) throws SAXException; /** * Notify of an entity reference. * @param entityName the name of the entity * @throws SAXException */ public void entityReference(String entityName) throws SAXException; /** * This method returns an object that has the current namespace mappings in * effect. * * @return NamespaceMappings an object that has the current namespace * mappings in effect. */ public NamespaceMappings getNamespaceMappings(); /** * This method returns the prefix that currently maps to the given namespace * URI. * @param uri the namespace URI * @return String the prefix that currently maps to the given URI. */ public String getPrefix(String uri); /** * This method gets the prefix associated with a current element or * attribute name. * @param name the qualified name of an element, or attribute * @param isElement true if it is an element name, false if it is an * atttribute name * @return String the namespace URI associated with the element or * attribute. */ public String getNamespaceURI(String name, boolean isElement); /** * This method returns the namespace URI currently associated with the * prefix. * @param prefix a prefix of an element or attribute. * @return String the namespace URI currently associated with the prefix. */ public String getNamespaceURIFromPrefix(String prefix); /** * This method is used to set the source locator, which might be used to * generated an error message. * @param locator the source locator */ public void setSourceLocator(SourceLocator locator); // Bit constants for addUniqueAttribute(). // The attribute value contains no bad characters. A "bad" character is one which // is greater than 126 or it is one of '<', '>', '&' or '"'. public static final int NO_BAD_CHARS = 0x1; // An HTML empty attribute (e.g.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy