FileDocCategorySizeDatePackage
ExtendedContentHandler.javaAPI DocJava SE 5 API8793Fri Aug 26 14:56:02 BST 2005com.sun.org.apache.xml.internal.serializer

ExtendedContentHandler

public interface ExtendedContentHandler implements ContentHandler
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)

Fields Summary
public static final int
NO_BAD_CHARS
public static final int
HTML_ATTREMPTY
public static final int
HTML_ATTRURL
Constructors Summary
Methods Summary
public voidaddAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value)
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
throws
SAXException

public voidaddAttribute(java.lang.String qName, java.lang.String value)
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 voidaddAttributes(org.xml.sax.Attributes atts)
Add attributes to the current element

param
atts the attributes to add.
throws
SAXException

public voidaddUniqueAttribute(java.lang.String qName, java.lang.String value, int flags)
Add a unique attribute to the current element. The attribute is guaranteed to be unique here. The serializer can write it out immediately without saving it in a table first. The integer flag contains information about the attribute, which helps the serializer to decide whether a particular processing is needed.

param
qName the fully qualified attribute name.
param
value the attribute value
param
flags a bitwise flag

public voidcharacters(java.lang.String chars)
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 voidendElement(java.lang.String elemName)
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 voidentityReference(java.lang.String entityName)
Notify of an entity reference.

param
entityName the name of the entity
throws
SAXException

public com.sun.org.apache.xml.internal.serializer.NamespaceMappingsgetNamespaceMappings()
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 java.lang.StringgetNamespaceURI(java.lang.String name, boolean isElement)
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 java.lang.StringgetNamespaceURIFromPrefix(java.lang.String prefix)
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 java.lang.StringgetPrefix(java.lang.String uri)
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 voidnamespaceAfterStartElement(java.lang.String uri, java.lang.String prefix)
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 voidsetSourceLocator(javax.xml.transform.SourceLocator locator)
This method is used to set the source locator, which might be used to generated an error message.

param
locator the source locator

public voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
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 voidstartElement(java.lang.String qName)
This method is used to notify of the start of an element

param
qName the fully qualified name of the element
throws
SAXException

public booleanstartPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush)
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