com.sun.xml.fastinfoset.sax
Class SAXDocumentSerializerWithPrefixMapping

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycom.sun.xml.fastinfoset.Encoder
          extended bycom.sun.xml.fastinfoset.sax.SAXDocumentSerializer
              extended bycom.sun.xml.fastinfoset.sax.SAXDocumentSerializerWithPrefixMapping
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, EncodingAlgorithmContentHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, ExtendedContentHandler, FastInfosetSerializer, FastInfosetWriter, org.xml.sax.ext.LexicalHandler, PrimitiveTypeContentHandler, RestrictedAlphabetContentHandler

public class SAXDocumentSerializerWithPrefixMapping
extends SAXDocumentSerializer

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
protected  StringIntMap _declaredNamespaces
           
protected  java.lang.String _lastCheckedNamespace
           
protected  java.lang.String _lastCheckedPrefix
           
protected  java.util.Map _namespaceToPrefixMapping
           
protected  java.util.Map _prefixToPrefixMapping
           
 
Fields inherited from class com.sun.xml.fastinfoset.sax.SAXDocumentSerializer
_charactersAsCDATA, _elementHasNamespaces
 
Fields inherited from class com.sun.xml.fastinfoset.Encoder
_b, _characterEncodingSchemeSystemDefault, _charBuffer, _markIndex, _octetBuffer, _octetBufferIndex, _s, _terminate, _v, _vData, attributeValueMapTotalCharactersConstraint, attributeValueSizeConstraint, CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY, characterContentChunkMapTotalCharactersConstraint, characterContentChunkSizeContraint, DATE_TIME_CHARACTERS_TABLE, NUMERIC_CHARACTERS_TABLE
 
Fields inherited from interface org.jvnet.fastinfoset.FastInfosetSerializer
ATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT, ATTRIBUTE_VALUE_SIZE_CONSTRAINT, BUFFER_SIZE_PROPERTY, CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT, CHARACTER_CONTENT_CHUNK_SIZE_CONSTRAINT, EXTERNAL_VOCABULARIES_PROPERTY, IGNORE_COMMENTS_FEATURE, IGNORE_DTD_FEATURE, IGNORE_PROCESSING_INSTRUCTIONS_FEATURE, IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, UTF_16BE, UTF_8
 
Constructor Summary
SAXDocumentSerializerWithPrefixMapping(java.util.Map namespaceToPrefixMapping)
           
 
Method Summary
protected  boolean encodeAttribute(java.lang.String namespaceURI, java.lang.String qName, java.lang.String localName)
           
protected  boolean encodeAttributeMapEntry(LocalNameQualifiedNamesMap.Entry entry, java.lang.String namespaceURI)
           
protected  void encodeAttributes(org.xml.sax.Attributes atts)
           
protected  void encodeElement(java.lang.String namespaceURI, java.lang.String qName, java.lang.String localName)
           
protected  boolean encodeElementMapEntry(LocalNameQualifiedNamesMap.Entry entry, java.lang.String namespaceURI)
           
protected  java.lang.String getPrefix(java.lang.String namespaceURI)
           
protected  void putPrefix(java.lang.String namespaceURI, java.lang.String prefix)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class com.sun.xml.fastinfoset.sax.SAXDocumentSerializer
alphabetCharacters, booleans, bytes, characters, characters, comment, countAttributes, dateTimeCharacters, doubles, endCDATA, endDocument, endDTD, endElement, endEntity, floats, ignorableWhitespace, ints, longs, numericCharacters, object, octets, processingInstruction, reset, setDocumentLocator, shorts, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, uuids
 
Methods inherited from class com.sun.xml.fastinfoset.Encoder
encodeAIIBuiltInAlgorithmData, encodeAIIObjectAlgorithmData, encodeAIIOctetAlgorithmData, encodeAlphabetCharacters, encodeAttributeQualifiedNameOnSecondBit, encodeCharacters, encodeCharactersNoClone, encodeCIIBuiltInAlgorithmData, encodeCIIBuiltInAlgorithmDataAsCDATA, encodeCIIObjectAlgorithmData, encodeCIIOctetAlgorithmData, encodeComment, encodeCommentNoClone, encodeDocumentTermination, encodeDocumentTypeDeclaration, encodeElementQualifiedNameOnThirdBit, encodeElementTermination, encodeFourBitCharacters, encodeHeader, encodeIdentifyingNonEmptyStringOnFirstBit, encodeInitialVocabulary, encodeLiteralAttributeQualifiedNameOnSecondBit, encodeLiteralElementQualifiedNameOnThirdBit, encodeNamespaceAttribute, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnSeventhBit, encodeNonEmptyFourBitCharacterString, encodeNonEmptyFourBitCharacterStringOnSeventhBit, encodeNonEmptyNBitCharacterStringOnSeventhBit, encodeNonEmptyOctetStringOnSecondBit, encodeNonEmptyUTF8StringAsOctetString, encodeNonEmptyUTF8StringAsOctetString, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonZeroInteger, encodeNonZeroIntegerOnFourthBit, encodeNonZeroIntegerOnSecondBitFirstBitOne, encodeNonZeroIntegerOnSecondBitFirstBitZero, encodeNonZeroIntegerOnThirdBit, encodeNonZeroOctetStringLength, encodeNonZeroOctetStringLengthOnFifthBit, encodeNonZeroOctetStringLengthOnSecondBit, encodeNonZeroOctetStringLengthOnSenventhBit, encodeProcessingInstruction, encodeTermination, encodeUtf16String, encodeUtf16String, encodeUTF8String, encodeUTF8String, getAttributeValueMapMemoryLimit, getAttributeValueSizeLimit, getCharacterContentChunkMapMemoryLimit, getCharacterContentChunkSizeLimit, getCharacterEncodingScheme, getIgnoreComments, getIgnoreDTD, getIgnoreProcesingInstructions, getIgnoreWhiteSpaceTextContent, getPrefixFromQualifiedName, getRegisteredEncodingAlgorithms, getVocabularyApplicationData, hasMark, isAttributeValueLengthMatchesLimit, isCharacterContentChunkLengthMatchesLimit, isWhiteSpace, isWhiteSpace, mark, resetMark, setAttributeValueMapMemoryLimit, setAttributeValueSizeLimit, setCharacterContentChunkMapMemoryLimit, setCharacterContentChunkSizeLimit, setCharacterEncodingScheme, setExternalVocabulary, setIgnoreComments, setIgnoreDTD, setIgnoreProcesingInstructions, setIgnoreWhiteSpaceTextContent, setOutputStream, setRegisteredEncodingAlgorithms, setVocabulary, setVocabularyApplicationData, write, write, write
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endPrefixMapping
 
Methods inherited from interface org.jvnet.fastinfoset.FastInfosetSerializer
getAttributeValueMapMemoryLimit, getAttributeValueSizeLimit, getCharacterContentChunkMapMemoryLimit, getCharacterContentChunkSizeLimit, getCharacterEncodingScheme, getIgnoreComments, getIgnoreDTD, getIgnoreProcesingInstructions, getIgnoreWhiteSpaceTextContent, getRegisteredEncodingAlgorithms, getVocabularyApplicationData, setAttributeValueMapMemoryLimit, setAttributeValueSizeLimit, setCharacterContentChunkMapMemoryLimit, setCharacterContentChunkSizeLimit, setCharacterEncodingScheme, setExternalVocabulary, setIgnoreComments, setIgnoreDTD, setIgnoreProcesingInstructions, setIgnoreWhiteSpaceTextContent, setOutputStream, setRegisteredEncodingAlgorithms, setVocabularyApplicationData
 

Field Detail

_namespaceToPrefixMapping

protected java.util.Map _namespaceToPrefixMapping

_prefixToPrefixMapping

protected java.util.Map _prefixToPrefixMapping

_lastCheckedNamespace

protected java.lang.String _lastCheckedNamespace

_lastCheckedPrefix

protected java.lang.String _lastCheckedPrefix

_declaredNamespaces

protected StringIntMap _declaredNamespaces
Constructor Detail

SAXDocumentSerializerWithPrefixMapping

public SAXDocumentSerializerWithPrefixMapping(java.util.Map namespaceToPrefixMapping)
Method Detail

startPrefixMapping

public final void startPrefixMapping(java.lang.String prefix,
                                     java.lang.String uri)
                              throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
startPrefixMapping in class SAXDocumentSerializer
Throws:
org.xml.sax.SAXException

encodeElement

protected final void encodeElement(java.lang.String namespaceURI,
                                   java.lang.String qName,
                                   java.lang.String localName)
                            throws java.io.IOException
Overrides:
encodeElement in class SAXDocumentSerializer
Throws:
java.io.IOException

encodeElementMapEntry

protected boolean encodeElementMapEntry(LocalNameQualifiedNamesMap.Entry entry,
                                        java.lang.String namespaceURI)
                                 throws java.io.IOException
Throws:
java.io.IOException

encodeAttributes

protected final void encodeAttributes(org.xml.sax.Attributes atts)
                               throws java.io.IOException,
                                      FastInfosetException
Overrides:
encodeAttributes in class SAXDocumentSerializer
Throws:
java.io.IOException
FastInfosetException

encodeAttribute

protected final boolean encodeAttribute(java.lang.String namespaceURI,
                                        java.lang.String qName,
                                        java.lang.String localName)
                                 throws java.io.IOException
Overrides:
encodeAttribute in class SAXDocumentSerializer
Throws:
java.io.IOException

encodeAttributeMapEntry

protected boolean encodeAttributeMapEntry(LocalNameQualifiedNamesMap.Entry entry,
                                          java.lang.String namespaceURI)
                                   throws java.io.IOException
Throws:
java.io.IOException

getPrefix

protected final java.lang.String getPrefix(java.lang.String namespaceURI)

putPrefix

protected final void putPrefix(java.lang.String namespaceURI,
                               java.lang.String prefix)