Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * ====================================================================
   * Copyright (c) 2004-2006 TMate Software Ltd.  All rights reserved.
   *
   * This software is licensed as described in the file COPYING, which
   * you should have received as part of this distribution.  The terms
   * are also available at http://svnkit.com/license.html
   * If newer versions of this license are posted there, you may use a
   * newer version instead, at your option.
  * ====================================================================
  */
 package org.tmatesoft.svn.core.wc.xml;
 
 import java.util.Date;
 
This is an implementation of the ISVNAnnotateHandler interface that writes XML formatted annotation information to a specified ContentHandler.

Author(s):
TMate Software Ltd.
Version:
1.1.0
 
 public class SVNXMLAnnotateHandler extends AbstractXMLHandler implements ISVNAnnotateHandler {
 
     public static final String PATH_ATTR = "path";
     public static final String REVISION_ATTR = "revision";
     public static final String DATE_TAG = "date";
     public static final String AUTHOR_TAG = "author";
     public static final String COMMIT_TAG = "commit";
     public static final String ENTRY_TAG = "entry";
     public static final String LINE_NUMBER_TAG = "line-number";
     public static final String TARGET_TAG = "target";
     public static final String BLAME_TAG = "blame";
     
     private long myLineNumber;
    
    
Creates a new annotation handler.

Parameters:
contentHandler a ContentHandler to form an XML tree
 
     public SVNXMLAnnotateHandler(ContentHandler contentHandler) {
         this(contentHandlernull);
     }

    
Creates a new annotation handler.

Parameters:
contentHandler a ContentHandler to form an XML tree
log a debug logger
 
     public SVNXMLAnnotateHandler(ContentHandler contentHandlerISVNDebugLog log) {
         super(contentHandlerlog);
     }
 
     protected String getHeaderName() {
         return ;
     }
    
    
Begins an XML tree with the target path/URL for which annotating is run.

Parameters:
pathOrURL a target file WC path or URL
 
     public void startTarget(String pathOrURL) {
          = 1;
         try {
             addAttribute(pathOrURL);
             openTag();
         } catch (SAXException e) {
             getDebugLog().error(e);
         }
     }
    
    
Closes the formatted XML output.
 
     public void endTarget() {
          = 1;
         try {
             closeTag();
         } catch (SAXException e) {
             getDebugLog().error(e);
        }
    }
    public void handleLine(Date datelong revisionString authorString linethrows SVNException {
        try {
            addAttribute( + "");
            openTag();
            if (revision >= 0) {
                addAttribute(revision + "");
                openTag();
                addTag(author);
                addTag(, SVNTimeUtil.formatDate(date));
                closeTag();
            }
            closeTag();
        } catch (SAXException e) {
            getDebugLog().error(e);
            SVNErrorMessage err = SVNErrorMessage.create(.e.getLocalizedMessage());
            SVNErrorManager.error(erre);
        } finally {
            ++;
        }
    }
New to GrepCode? Check out our FAQ X