You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/11/13 00:35:34 UTC

cvs commit: jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax ContentHandlerAdapter.java ContentHandlerProxy.java DocumentHandlerAdapter.java JaxpParser.java NOPContentHandler.java NOPLexicalHandler.java Parser.java XMLConsumerProxy.java

donaldp     2002/11/12 15:35:34

  Modified:    xmlutil/src/java/org/apache/excalibur/xml/dom
                        DOMHandler.java DOMHandlerFactory.java
                        DOMSerializer.java DefaultDOMHandler.java
               xmlutil/src/java/org/apache/excalibur/xml/sax
                        ContentHandlerAdapter.java ContentHandlerProxy.java
                        DocumentHandlerAdapter.java JaxpParser.java
                        NOPContentHandler.java NOPLexicalHandler.java
                        Parser.java XMLConsumerProxy.java
  Log:
  Optimize imports/stryle
  
  Revision  Changes    Path
  1.3       +3 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMHandler.java
  
  Index: DOMHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMHandler.java	16 Aug 2002 10:42:36 -0000	1.2
  +++ DOMHandler.java	12 Nov 2002 23:35:34 -0000	1.3
  @@ -17,7 +17,8 @@
    * @author <a href="mailto:mirceatoma@apache.org">Mircea Toma</a>
    * @version CVS $Revision$ $Date$
    */
  -public interface DOMHandler extends ContentHandler
  +public interface DOMHandler
  +    extends ContentHandler
   {
       Document getDocument();
   }
  
  
  
  1.5       +5 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMHandlerFactory.java
  
  Index: DOMHandlerFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMHandlerFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOMHandlerFactory.java	2 Oct 2002 01:47:05 -0000	1.4
  +++ DOMHandlerFactory.java	12 Nov 2002 23:35:34 -0000	1.5
  @@ -20,7 +20,9 @@
   {
       String ROLE = DOMHandlerFactory.class.getName();
   
  -    DOMHandler createDOMHandler() throws Exception;
  +    DOMHandler createDOMHandler()
  +        throws Exception;
   
  -    DOMHandler createDOMHandler( Document document ) throws Exception;
  +    DOMHandler createDOMHandler( Document document )
  +        throws Exception;
   }
  
  
  
  1.4       +5 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMSerializer.java
  
  Index: DOMSerializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DOMSerializer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMSerializer.java	2 Oct 2002 01:52:25 -0000	1.3
  +++ DOMSerializer.java	12 Nov 2002 23:35:34 -0000	1.4
  @@ -22,5 +22,8 @@
   {
       String ROLE = DOMSerializer.class.getName();
   
  -    void serialize( Document document, ContentHandler contentHandler, LexicalHandler lexicalHandler ) throws SAXException;
  +    void serialize( Document document,
  +                    ContentHandler contentHandler,
  +                    LexicalHandler lexicalHandler )
  +        throws SAXException;
   }
  
  
  
  1.7       +3 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DefaultDOMHandler.java
  
  Index: DefaultDOMHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/dom/DefaultDOMHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultDOMHandler.java	2 Oct 2002 01:52:25 -0000	1.6
  +++ DefaultDOMHandler.java	12 Nov 2002 23:35:34 -0000	1.7
  @@ -22,7 +22,8 @@
   {
       private final Document m_document;
   
  -    public DefaultDOMHandler( TransformerHandler handler, Document document )
  +    public DefaultDOMHandler( TransformerHandler handler,
  +                              Document document )
       {
           super( handler, handler );
           m_document = document;
  
  
  
  1.5       +39 -37    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/ContentHandlerAdapter.java
  
  Index: ContentHandlerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/ContentHandlerAdapter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContentHandlerAdapter.java	16 Oct 2002 22:50:19 -0000	1.4
  +++ ContentHandlerAdapter.java	12 Nov 2002 23:35:34 -0000	1.5
  @@ -25,105 +25,107 @@
    * @version CVS $Revision$ $Date$
    */
   
  -public class ContentHandlerAdapter implements DocumentHandler
  -{    
  +public class ContentHandlerAdapter
  +    implements DocumentHandler
  +{
       private final static String XMLNS = "xmlns";
       private final static String XMLNS_PREFIX = "xmlns:";
  +
       private final ContentHandler m_handler;
       private final NamespaceSupport m_support = new NamespaceSupport();
  -    
  +
       public ContentHandlerAdapter( final ContentHandler handler )
       {
           m_handler = handler;
       }
  -    
  +
       public void setDocumentLocator( final Locator locator )
       {
           m_handler.setDocumentLocator( locator );
       }
  -    
  +
       public void startDocument() throws SAXException
       {
           m_handler.startDocument();
       }
  -    
  +
       public void endDocument() throws SAXException
       {
           m_handler.endDocument();
       }
  -    
  -    public void characters( final char ch[], 
  -                            final int start, 
  +
  +    public void characters( final char ch[],
  +                            final int start,
                               final int length ) throws SAXException
       {
           m_handler.characters( ch, start, length );
       }
  -    
  -    public void ignorableWhitespace( final char ch[], 
  -                                     final int start, 
  +
  +    public void ignorableWhitespace( final char ch[],
  +                                     final int start,
                                        final int length ) throws SAXException
       {
           m_handler.ignorableWhitespace( ch, start, length );
       }
  -    
  -    public void processingInstruction( final String target, 
  +
  +    public void processingInstruction( final String target,
                                          final String data ) throws SAXException
       {
           m_handler.processingInstruction( target, data );
       }
  -    
  -    public void startElement( final String name, 
  +
  +    public void startElement( final String name,
                                 final AttributeList atts ) throws SAXException
       {
           m_support.pushContext();
  -        
  -        for (int i = 0; i < atts.getLength(); i++)
  +
  +        for( int i = 0; i < atts.getLength(); i++ )
           {
  -            final String attributeName = atts.getName(i);
  -            if ( attributeName.startsWith( XMLNS_PREFIX ) )
  +            final String attributeName = atts.getName( i );
  +            if( attributeName.startsWith( XMLNS_PREFIX ) )
               {
                   m_support.declarePrefix( attributeName.substring( 6 ), atts.getValue( i ) );
               }
  -            else if ( attributeName.equals( XMLNS ) )
  +            else if( attributeName.equals( XMLNS ) )
               {
                   m_support.declarePrefix( "", atts.getValue( i ) );
               }
           }
  -        
  +
           final AttributesImpl attributes = new AttributesImpl();
  -        for ( int i = 0; i < atts.getLength(); i++ )
  +        for( int i = 0; i < atts.getLength(); i++ )
           {
  -            final String attributeName = atts.getName(i);
  -            if ( !attributeName.startsWith( XMLNS_PREFIX ) && !attributeName.equals( XMLNS ) )
  +            final String attributeName = atts.getName( i );
  +            if( !attributeName.startsWith( XMLNS_PREFIX ) && !attributeName.equals( XMLNS ) )
               {
  -                final String[] parts = m_support.processName( attributeName, new String[3], true );
  -                attributes.addAttribute(parts[0], parts[1], parts[2], atts.getType( i ), atts.getValue( i ) );
  +                final String[] parts = m_support.processName( attributeName, new String[ 3 ], true );
  +                attributes.addAttribute( parts[ 0 ], parts[ 1 ], parts[ 2 ], atts.getType( i ), atts.getValue( i ) );
               }
           }
  -        
  +
           final Enumeration e = m_support.getDeclaredPrefixes();
           while( e.hasMoreElements() )
           {
               final String prefix = (String)e.nextElement();
               m_handler.startPrefixMapping( prefix, m_support.getURI( prefix ) );
           }
  -        
  -        final String[] parts = m_support.processName( name, new String[3], false );
  -        m_handler.startElement( parts[0], parts[1], parts[2], attributes );
  +
  +        final String[] parts = m_support.processName( name, new String[ 3 ], false );
  +        m_handler.startElement( parts[ 0 ], parts[ 1 ], parts[ 2 ], attributes );
       }
  -    
  +
       public void endElement( final String name ) throws SAXException
       {
  -        final String[] parts = m_support.processName( name, new String[3], false );
  -        m_handler.endElement( parts[0], parts[1], parts[2] );
  -        
  +        final String[] parts = m_support.processName( name, new String[ 3 ], false );
  +        m_handler.endElement( parts[ 0 ], parts[ 1 ], parts[ 2 ] );
  +
           final Enumeration e = m_support.getDeclaredPrefixes();
           while( e.hasMoreElements() )
           {
               final String prefix = (String)e.nextElement();
               m_handler.endPrefixMapping( prefix );
           }
  -        
  +
           m_support.popContext();
       }
   }
  
  
  
  1.2       +4 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/ContentHandlerProxy.java
  
  Index: ContentHandlerProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/ContentHandlerProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContentHandlerProxy.java	16 Oct 2002 17:11:00 -0000	1.1
  +++ ContentHandlerProxy.java	12 Nov 2002 23:35:34 -0000	1.2
  @@ -20,7 +20,8 @@
    * @author <a href="mailto:mirceatoma@apache.org">Mircea Toma</a>
    * @version CVS $Revision$ $Date$
    */
  -public class ContentHandlerProxy implements ContentHandler
  +public class ContentHandlerProxy
  +    implements ContentHandler
   {
       /** The current {@link ContentHandler}. */
       private final ContentHandler m_contentHandler;
  @@ -28,7 +29,7 @@
       /**
        * Create a new <code>ContentHandlerWrapper</code> instance.
        */
  -    public ContentHandlerProxy(final ContentHandler contentHandler)
  +    public ContentHandlerProxy( final ContentHandler contentHandler )
       {
           m_contentHandler = contentHandler;
       }
  
  
  
  1.7       +18 -17    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/DocumentHandlerAdapter.java
  
  Index: DocumentHandlerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/DocumentHandlerAdapter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DocumentHandlerAdapter.java	12 Nov 2002 23:31:37 -0000	1.6
  +++ DocumentHandlerAdapter.java	12 Nov 2002 23:35:34 -0000	1.7
  @@ -36,7 +36,7 @@
       /**
        * Create a new <code>ContentHandlerWrapper</code> instance.
        */
  -    public DocumentHandlerAdapter(final DocumentHandler documentHandler)
  +    public DocumentHandlerAdapter( final DocumentHandler documentHandler )
       {
           m_documentHandler = documentHandler;
       }
  @@ -71,7 +71,7 @@
        */
       public void startPrefixMapping( final String prefix, final String uri ) throws SAXException
       {
  -        if ( !m_contextPushed )
  +        if( !m_contextPushed )
           {
               m_support.pushContext();
               m_contextPushed = true;
  @@ -96,30 +96,30 @@
                                 final String raw,
                                 final Attributes a ) throws SAXException
       {
  -        if ( !m_contextPushed )
  +        if( !m_contextPushed )
           {
               m_support.pushContext();
           }
           m_contextPushed = false;
   
  -        final String name = getTagName(loc, raw, uri);
  +        final String name = getTagName( loc, raw, uri );
   
           final AttributeListImpl attributeList = new AttributeListImpl();
  -        for (int i = 0; i < a.getLength(); i++)
  +        for( int i = 0; i < a.getLength(); i++ )
           {
               String attributeName = a.getQName( i );
  -            if ( ( attributeName == null ) || ( attributeName.length() == 0 ) )
  +            if( ( attributeName == null ) || ( attributeName.length() == 0 ) )
               {
  -                final String attributeNamespaceURI = a.getURI(i);
  -                final String attributeLocalName = a.getLocalName(i);
  -                if ( attributeNamespaceURI.length() == 0 )
  +                final String attributeNamespaceURI = a.getURI( i );
  +                final String attributeLocalName = a.getLocalName( i );
  +                if( attributeNamespaceURI.length() == 0 )
                   {
                       attributeName = attributeLocalName;
                   }
                   else
                   {
                       final String prefix = m_support.getPrefix( attributeNamespaceURI );
  -                    if (prefix == null)
  +                    if( prefix == null )
                       {
                           throw new SAXException( "No attribute prefix for namespace URI: " + attributeNamespaceURI );
                       }
  @@ -133,7 +133,7 @@
           while( e.hasMoreElements() )
           {
               final String prefix = (String)e.nextElement();
  -            if ( prefix.length() == 0 )
  +            if( prefix.length() == 0 )
               {
                   attributeList.addAttribute( XMLNS, CDATA, uri );
               }
  @@ -200,7 +200,7 @@
   
       private String getTagName( final String loc, final String raw, final String uri ) throws SAXException
       {
  -        if (raw != null && raw.length() > 0)
  +        if( raw != null && raw.length() > 0 )
           {
               return raw;
           }
  @@ -213,16 +213,16 @@
   
       private String getTagPrefix( final String uri ) throws SAXException
       {
  -        if ( m_support.getPrefix( uri ) == null )
  +        if( m_support.getPrefix( uri ) == null )
           {
  -            if ( ( uri == null ) || ( uri.length() < 1 ) )
  +            if( ( uri == null ) || ( uri.length() < 1 ) )
               {
                   return "";
               }
               else
               {
                   final String defaultURI = m_support.getURI( "" );
  -                if ( ( defaultURI != null ) && defaultURI.equals( uri ) )
  +                if( ( defaultURI != null ) && defaultURI.equals( uri ) )
                   {
                       return ""; // default namespace
                   }
  @@ -232,7 +232,8 @@
                   }
               }
           }
  -        else {
  +        else
  +        {
               return m_support.getPrefix( uri );
           }
       }
  
  
  
  1.4       +10 -10    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/JaxpParser.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JaxpParser.java	12 Nov 2002 23:32:52 -0000	1.3
  +++ JaxpParser.java	12 Nov 2002 23:35:34 -0000	1.4
  @@ -10,13 +10,8 @@
   import java.io.IOException;
   import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.parsers.SAXParserFactory;
  -import org.xml.sax.ContentHandler;
  -import org.xml.sax.ErrorHandler;
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXParseException;
  -import org.xml.sax.XMLReader;
  -import org.xml.sax.ext.LexicalHandler;
  +import org.apache.avalon.excalibur.pool.Poolable;
  +import org.apache.avalon.excalibur.xml.EntityResolver;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.ParameterException;
  @@ -25,8 +20,13 @@
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.avalon.excalibur.pool.Poolable;
  -import org.apache.avalon.excalibur.xml.EntityResolver;
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.ErrorHandler;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
  +import org.xml.sax.XMLReader;
  +import org.xml.sax.ext.LexicalHandler;
   
   /**
    * An XMLParser that is only dependant on JAXP 1.1 compliant parsers.
  
  
  
  1.2       +4 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/NOPContentHandler.java
  
  Index: NOPContentHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/NOPContentHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NOPContentHandler.java	13 Oct 2002 03:21:37 -0000	1.1
  +++ NOPContentHandler.java	12 Nov 2002 23:35:34 -0000	1.2
  @@ -7,8 +7,8 @@
    */
   package org.apache.excalibur.xml.sax;
   
  -import org.xml.sax.ContentHandler;
   import org.xml.sax.Attributes;
  +import org.xml.sax.ContentHandler;
   import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   
  @@ -19,7 +19,8 @@
    * @author <a href="mailto:mirceatoma@apache.org">Mircea Toma</a>
    * @version CVS $Revision$ $Date$
    */
  -public class NOPContentHandler implements ContentHandler
  +public class NOPContentHandler
  +    implements ContentHandler
   {
       /**
        * Receive an object for locating the origin of SAX document events.
  
  
  
  1.2       +4 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/NOPLexicalHandler.java
  
  Index: NOPLexicalHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/NOPLexicalHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NOPLexicalHandler.java	13 Oct 2002 03:23:28 -0000	1.1
  +++ NOPLexicalHandler.java	12 Nov 2002 23:35:34 -0000	1.2
  @@ -7,8 +7,8 @@
    */
   package org.apache.excalibur.xml.sax;
   
  -import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.SAXException;
  +import org.xml.sax.ext.LexicalHandler;
   
   /**
    * This class provides default implementation of the methods specified
  @@ -17,7 +17,8 @@
    * @author <a href="mailto:mirceatoma@apache.org">Mircea Toma</a>
    * @version CVS $Revision$ $Date$
    */
  -public class NOPLexicalHandler implements LexicalHandler
  +public class NOPLexicalHandler
  +    implements LexicalHandler
   {
       /**
        * Report the start of DTD declarations, if any.
  
  
  
  1.3       +1 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/Parser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Parser.java	15 Oct 2002 23:55:37 -0000	1.2
  +++ Parser.java	12 Nov 2002 23:35:34 -0000	1.3
  @@ -8,8 +8,6 @@
   package org.apache.excalibur.xml.sax;
   
   import java.io.IOException;
  -import org.apache.avalon.framework.component.Component;
  -import org.w3c.dom.Document;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  
  
  
  1.2       +8 -9      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/XMLConsumerProxy.java
  
  Index: XMLConsumerProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/XMLConsumerProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLConsumerProxy.java	16 Oct 2002 17:22:29 -0000	1.1
  +++ XMLConsumerProxy.java	12 Nov 2002 23:35:34 -0000	1.2
  @@ -7,38 +7,37 @@
    */
   package org.apache.excalibur.xml.sax;
   
  -import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
  -import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   import org.xml.sax.ext.LexicalHandler;
   
   /**
    * This class is an utility class proxying a SAX version 2.0
  - * {@link ContentHandler} and {@link LexicalHandler) and forwarding it those 
  + * {@link ContentHandler} and {@link LexicalHandler) and forwarding it those
    * events received throug its {@link XMLConsumer}s interface.
    *
    * @author <a href="mailto:mirceatoma@apache.org">Mircea Toma</a>
    * @version CVS $Revision$ $Date$
    */
  -public class XMLConsumerProxy extends ContentHandlerProxy implements XMLConsumer
  +public class XMLConsumerProxy
  +    extends ContentHandlerProxy implements XMLConsumer
   {
       /** The {@link LexicalHandler} */
       private LexicalHandler m_lexicalHandler;
  -    
  +
       /**
        * Create a new <code>XMLConsumerProxy</code> instance.
        */
  -    public XMLConsumerProxy(final ContentHandler contentHandler, final LexicalHandler lexicalHandler)
  +    public XMLConsumerProxy( final ContentHandler contentHandler, final LexicalHandler lexicalHandler )
       {
  -        super(contentHandler);
  +        super( contentHandler );
           m_lexicalHandler = lexicalHandler;
       }
   
       /**
        * Create a new <code>XMLConsumerProxy</code> instance.
        */
  -    public XMLConsumerProxy(final XMLConsumer xmlConsumer)
  +    public XMLConsumerProxy( final XMLConsumer xmlConsumer )
       {
           this( xmlConsumer, xmlConsumer );
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>