Coverage Report - net.spy.digg.parsers.ErrorParser
 
Classes in this File Line Coverage Branch Coverage Complexity
ErrorParser
100%
8/8
N/A
0
 
 1  
 package net.spy.digg.parsers;
 2  
 
 3  
 import java.io.IOException;
 4  
 
 5  
 import org.w3c.dom.Document;
 6  
 import org.w3c.dom.Node;
 7  
 import org.xml.sax.SAXException;
 8  
 
 9  
 /**
 10  
  * Parse a single error.
 11  
  */
 12  3
 public class ErrorParser extends BaseParser {
 13  
 
 14  
         private int errorId;
 15  
         private String errorMessage;
 16  
 
 17  
         @Override
 18  
         protected String getRootElementName() {
 19  3
                 return "error";
 20  
         }
 21  
 
 22  
         @Override
 23  
         protected void handleDocument(Document doc)
 24  
                 throws SAXException, IOException {
 25  3
         final Node n=doc.getFirstChild();
 26  3
             errorId=Integer.parseInt(getAttr(n, "code"));
 27  3
             errorMessage=getAttr(n, "message");
 28  3
         }
 29  
 
 30  
         /**
 31  
          * Get the error ID.
 32  
          */
 33  
         public int getErrorId() {
 34  3
                 return errorId;
 35  
         }
 36  
 
 37  
         /**
 38  
          * Get the error message.
 39  
          */
 40  
         public String getErrorMessage() {
 41  3
                 return errorMessage;
 42  
         }
 43  
 
 44  
 }