java.lang.Object
AbstractLoggable
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.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.
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
AbstractTextSerializer.NamespaceAsAttributes
public AbstractTextSerializer.NamespaceAsAttributes()
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()