Class XmlnsContentHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class XmlnsContentHandler
    extends ProxyContentHandler
    Content handler proxy that adds explicit "xmlns" attributes for all namespace mappings introduced through startPrefixMapping(String, String) calls.
    • Constructor Detail

      • XmlnsContentHandler

        public XmlnsContentHandler​(org.xml.sax.ContentHandler handler)
    • Method Detail

      • startPrefixMapping

        public void startPrefixMapping​(java.lang.String prefix,
                                       java.lang.String uri)
                                throws org.xml.sax.SAXException
        Records the namespace mapping and passes the call to the proxied content handler.
        Specified by:
        startPrefixMapping in interface org.xml.sax.ContentHandler
        Overrides:
        startPrefixMapping in class ProxyContentHandler
        Parameters:
        prefix - passed through
        uri - passed through
        Throws:
        org.xml.sax.SAXException - if an error occurs
      • startElement

        public void startElement​(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXException
        Adds the recorded namespace mappings (if any) as "xmlns" attributes before passing the call on to the proxied content handler.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class ProxyContentHandler
        Parameters:
        namespaceURI - passed through
        localName - passed through
        qName - passed through
        atts - passed through
        Throws:
        org.xml.sax.SAXException - if an error occurs