Top Description Fields Constructors Methods
com.sun.xml.fastinfoset.sax

public Class SAXDocumentSerializerWithPrefixMapping

extends SAXDocumentSerializer
Class Inheritance
Imports
com.sun.xml.fastinfoset.EncodingConstants, .QualifiedName, com.sun.xml.fastinfoset.util.KeyIntMap, .LocalNameQualifiedNamesMap, .StringIntMap, java.io.IOException, java.util.HashMap, .Map, org.xml.sax.SAXException, .Attributes, org.jvnet.fastinfoset.FastInfosetException, .RestrictedAlphabet, org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes

The Fast Infoset SAX serializer that maps prefixes to user specified prefixes that are specified in a namespace URI to prefix map.

This serializer will not preserve the original prefixes and this serializer should not be used when prefixes need to be preserved, such as the case when there are qualified names in content.

A namespace URI to prefix map is utilized such that the prefixes in the map are utilized rather than the prefixes specified in the qualified name for elements and attributes.

Any namespace declarations with a namespace URI that is not present in the map are added.

Field Summary

Modifier and TypeField and Description
protected StringIntMap
protected String
protected String
protected Map<String, String>
protected Map<String, String>
Inherited from com.sun.xml.fastinfoset.sax.SAXDocumentSerializer:
_charactersAsCDATA_elementHasNamespaces

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
protected final boolean
protected boolean
protected final void
protected final void
protected boolean
protected final String
getPrefix(String namespaceURI)

protected final void
putPrefix(String namespaceURI, String prefix)

public final void
Inherited from com.sun.xml.fastinfoset.sax.SAXDocumentSerializer:
alphabetCharactersbooleansbytescharacterscharacterscommentcountAttributesdateTimeCharactersdoublesendCDATAendDocumentendDTDendElementendEntityfloatsignorableWhitespaceintslongsnumericCharactersobjectoctetsprocessingInstructionresetsetDocumentLocatorshortsskippedEntitystartCDATAstartDocumentstartDTDstartElementstartEntityuuids

Field Detail

_declaredNamespacesback to summary
protected StringIntMap _declaredNamespaces
_lastCheckedNamespaceback to summary
protected String _lastCheckedNamespace
_lastCheckedPrefixback to summary
protected String _lastCheckedPrefix
_namespaceToPrefixMappingback to summary
protected Map<String, String> _namespaceToPrefixMapping
_prefixToPrefixMappingback to summary
protected Map<String, String> _prefixToPrefixMapping

Constructor Detail

SAXDocumentSerializerWithPrefixMappingback to summary
public SAXDocumentSerializerWithPrefixMapping(Map<String, String> namespaceToPrefixMapping)

Method Detail

convertQNameback to summary
private String convertQName(String qName)
encodeAttributeback to summary
protected final boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException

Overrides com.sun.xml.fastinfoset.sax.SAXDocumentSerializer.encodeAttribute.

Annotations
@Override
encodeAttributeMapEntryback to summary
protected boolean encodeAttributeMapEntry(LocalNameQualifiedNamesMap.Entry entry, String namespaceURI) throws IOException
encodeAttributesback to summary
protected final void encodeAttributes(Attributes atts) throws IOException, FastInfosetException

Overrides com.sun.xml.fastinfoset.sax.SAXDocumentSerializer.encodeAttributes.

Annotations
@Override
encodeElementback to summary
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException

Overrides com.sun.xml.fastinfoset.sax.SAXDocumentSerializer.encodeElement.

Annotations
@Override
encodeElementMapEntryback to summary
protected boolean encodeElementMapEntry(LocalNameQualifiedNamesMap.Entry entry, String namespaceURI) throws IOException
getPrefixback to summary
protected final String getPrefix(String namespaceURI)
putPrefixback to summary
protected final void putPrefix(String namespaceURI, String prefix)
startPrefixMappingback to summary
public final void startPrefixMapping(String prefix, String uri) throws SAXException

Overrides com.sun.xml.fastinfoset.sax.SAXDocumentSerializer.startPrefixMapping.

Implements org.xml.sax.ContentHandler.startPrefixMapping.

Doc from org.xml.sax.ContentHandler.startPrefixMapping.

Begin the scope of a prefix-URI Namespace mapping.

The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default).

There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.

Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each other: all startPrefixMapping events will occur immediately before the corresponding startElement event, and all endPrefixMapping events will occur immediately after the corresponding endElement event, but their order is not otherwise guaranteed.

There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.

Annotations
@Override
Exceptions
SAXException:
the client may throw an exception during processing