Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.cocoon.serialization
Class AbstractTextSerializer.NamespaceAsAttributes  view AbstractTextSerializer.NamespaceAsAttributes download AbstractTextSerializer.NamespaceAsAttributes.java

java.lang.Object
  extended byAbstractLoggable
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.serialization.AbstractTextSerializer.NamespaceAsAttributes
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer
Enclosing class:
AbstractTextSerializer

public static class AbstractTextSerializer.NamespaceAsAttributes
extends org.apache.cocoon.xml.AbstractXMLPipe

A pipe that ensures that all namespace prefixes are also present as 'xmlns:' attributes. This used to circumvent Xalan's serialization behaviour which is to ignore namespaces if they're not present as 'xmlns:xxx' attributes.


Field Summary
private  boolean hasMappings
          True if there has been some startPrefixMapping() for the coming element.
private  java.util.List prefixList
          The prefixes of startPreficMapping() declarations for the coming element.
private  java.util.Map prefixToUriMap
           
private  java.util.List uriList
          The URIs of startPrefixMapping() declarations for the coming element.
private  java.util.Map uriToPrefixMap
          Maps of URI<->prefix mappings.
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Constructor Summary
AbstractTextSerializer.NamespaceAsAttributes()
           
 
Method Summary
private  void clearMappings()
           
 void endDocument()
          Receive notification of the end of a document.
 void endElement(java.lang.String eltUri, java.lang.String eltLocalName, java.lang.String eltQName)
          Receive notification of the end of an element.
 void endPrefixMapping(java.lang.String prefix)
          End the scope of a prefix-URI mapping: remove entry from mapping tables.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(java.lang.String eltUri, java.lang.String eltLocalName, java.lang.String eltQName, org.xml.sax.Attributes attrs)
          Ensure all namespace declarations are present as xmlns: attributes and add those needed before calling superclass.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Track mappings to be able to add xmlns: attributes in startElement().
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle, setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

prefixList

private java.util.List prefixList
The prefixes of startPreficMapping() declarations for the coming element.


uriList

private java.util.List uriList
The URIs of startPrefixMapping() declarations for the coming element.


uriToPrefixMap

private java.util.Map uriToPrefixMap
Maps of URI<->prefix mappings. Used to work around a bug in the Xalan serializer.


prefixToUriMap

private java.util.Map prefixToUriMap

hasMappings

private boolean hasMappings
True if there has been some startPrefixMapping() for the coming element.

Constructor Detail

AbstractTextSerializer.NamespaceAsAttributes

public AbstractTextSerializer.NamespaceAsAttributes()
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Receive notification of the beginning of a document.


startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Track mappings to be able to add xmlns: attributes in startElement().


startElement

public void startElement(java.lang.String eltUri,
                         java.lang.String eltLocalName,
                         java.lang.String eltQName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Ensure all namespace declarations are present as xmlns: attributes and add those needed before calling superclass. This is a workaround for a Xalan bug (at least in version 2.0.1) : org.apache.xalan.serialize.SerializerToXML ignores start/endPrefixMapping().


endElement

public void endElement(java.lang.String eltUri,
                       java.lang.String eltLocalName,
                       java.lang.String eltQName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element. Try to restore the element qName.


endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
End the scope of a prefix-URI mapping: remove entry from mapping tables.


endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Description copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Receive notification of the end of a document.


clearMappings

private void clearMappings()