Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 57   Methods: 4
NCLOC: 37   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
DescriptionBuilder.java 80% 94,1% 100% 90,3%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 package org.jbind.xml.test;
 11   
 
 12   
 import java.net.URL;
 13   
 
 14   
 import org.jbind.base.Console;
 15   
 import org.xml.sax.Attributes;
 16   
 import org.xml.sax.InputSource;
 17   
 import org.xml.sax.helpers.DefaultHandler;
 18   
 
 19   
 public class DescriptionBuilder extends DefaultHandler {
 20   
 
 21   
   private DescriptionInfo myInfo = null;
 22   
   private TestInfo myCurrentTestInfo = null;
 23   
 
 24  24
   public DescriptionBuilder() {}
 25   
 
 26  89
   public void startElement(String aUri, String aLocalName, String aQName, Attributes anAttributes) {
 27  89
     if ("description".equals(aQName)) {
 28  24
       myInfo = new DescriptionInfo(anAttributes.getValue("schema"));
 29  24
       myCurrentTestInfo = myInfo;
 30  65
     } else if ("instanceTest".equals(aQName)) {
 31  34
       myCurrentTestInfo = new InstanceTestInfo(myInfo, anAttributes.getValue("name"), anAttributes.getValue("fileName"), anAttributes.getValue("className"));
 32  34
       myInfo.instanceTestInfos.add(myCurrentTestInfo);
 33  31
     } else if ("errorMessage".equals(aQName)) {
 34  29
       myCurrentTestInfo.add(new ErrorMessageInfo(anAttributes.getValue("pattern")));
 35  2
     } else if ("att".equals(aQName)) {
 36  2
       myCurrentTestInfo.setAttribute(anAttributes.getValue("key"), anAttributes.getValue("value"));
 37   
     } else {
 38  0
       Console.err("ignoring unexpected element: " + aQName);
 39   
     }
 40   
   }
 41   
 
 42  24
   public InputSource resolveEntity(String aPublicId, String aSystemId) {
 43  24
     InputSource res = null;
 44  24
     if ((null != aSystemId) && aSystemId.endsWith("description.dtd")) {
 45  24
       URL url = DescriptionBuilder.class.getResource("description.dtd");
 46  24
       res = new InputSource(url.toString());
 47   
     }
 48  24
     return res;
 49   
   }
 50   
 
 51  24
   public DescriptionInfo getDescription() {
 52  24
     return myInfo;
 53   
   }
 54   
 
 55   
 
 56   
 }
 57