public void startElement()

in src/main/java/org/apache/maven/plugin/changelog/ChangeLogHandler.java [168:253]


    public void startElement( String uri, String localName, String qName, Attributes attributes )
        throws SAXException
    {
        bufData = "";

        if ( "file".equals( qName ) )
        {
            bufFile = new ChangeFile( "" );
        }
        else if ( "changelog-entry".equals( qName ) )
        {
            bufEntry = new ChangeSet();
        }
        else if ( "date".equals( qName ) )
        {
            currentPattern = attributes.getValue( "pattern" );
            if ( currentPattern == null )
            {
                currentPattern = "yyyy-MM-dd";
            }
        }
        else if ( "time".equals( qName ) )
        {
            currentPattern = attributes.getValue( "pattern" );
            if ( currentPattern == null )
            {
                currentPattern = "HH:mm:ss";
            }
        }
        else if ( "changeset".equals( qName ) )
        {
            bufEntries = new LinkedList<ChangeSet>();

            currentPattern = attributes.getValue( "datePattern" );
            if ( currentPattern == null )
            {
                currentPattern = "yyyy-MM-dd";
            }

            SimpleDateFormat formatter = new SimpleDateFormat( currentPattern );

            String start = attributes.getValue( "start" );

            String end = attributes.getValue( "end" );

            Date startDate = null;

            Date endDate = null;

            if ( start != null )
            {
                try
                {
                    startDate = formatter.parse( start );
                }
                catch ( ParseException e )
                {
                    throw new SAXException( "Can't parse start date '" + start + "'.", e );
                }
            }

            if ( end != null )
            {
                try
                {
                    endDate = formatter.parse( end );
                }
                catch ( ParseException e )
                {
                    throw new SAXException( "Can't parse end date '" + end + "'.", e );
                }
            }

            bufSet = new ChangeLogSet( bufEntries, startDate, endDate );
            String startVersion = attributes.getValue( "startVersion" );
            if ( startVersion != null )
            {
                bufSet.setStartVersion( new ScmTag( startVersion ) );
            }
            String endVersion = attributes.getValue( "endVersion" );
            if ( endVersion != null )
            {
                bufSet.setEndVersion( new ScmTag( endVersion ) );
            }
        }
    }