Coverage report

  %line %branch
org.apache.commons.jelly.tags.xml.DoctypeTag
74% 
94% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.jelly.tags.xml;
 17  
 
 18  
 import org.apache.commons.jelly.JellyTagException;
 19  
 import org.apache.commons.jelly.MissingAttributeException;
 20  
 import org.apache.commons.jelly.XMLOutput;
 21  
 import org.apache.commons.jelly.xpath.XPathTagSupport;
 22  
 
 23  
 import org.xml.sax.SAXException;
 24  
 
 25  
 /**
 26  
  * A tag which outputs a DOCTYPE declaration to the current XML output pipe.
 27  
  * Note that there should only be a single DOCTYPE declaration in any XML stream and
 28  
  * it should occur before any element content.
 29  
  *
 30  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 31  
  * @version $Revision: 1.5 $
 32  
  */
 33  
 public class DoctypeTag extends XPathTagSupport {
 34  
 
 35  
     private String name;
 36  
     private String publicId;
 37  
     private String systemId;
 38  
 
 39  1
     public DoctypeTag() {
 40  1
     }
 41  
 
 42  
     // Tag interface
 43  
     //-------------------------------------------------------------------------
 44  
     public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
 45  1
         if (name == null) {
 46  0
             throw new MissingAttributeException( "name" );
 47  
         }
 48  
 
 49  
         try {
 50  1
             output.startDTD(name, publicId, systemId);
 51  1
             invokeBody(output);
 52  1
             output.endDTD();
 53  1
         } catch (SAXException e) {
 54  0
             throw new JellyTagException(e);
 55  
         }
 56  1
     }
 57  
 
 58  
     // Properties
 59  
     //-------------------------------------------------------------------------
 60  
     /**
 61  
      * Returns the name.
 62  
      * @return String
 63  
      */
 64  
     public String getName() {
 65  0
         return name;
 66  
     }
 67  
 
 68  
     /**
 69  
      * Returns the publicId.
 70  
      * @return String
 71  
      */
 72  
     public String getPublicId() {
 73  0
         return publicId;
 74  
     }
 75  
 
 76  
     /**
 77  
      * Returns the systemId.
 78  
      * @return String
 79  
      */
 80  
     public String getSystemId() {
 81  0
         return systemId;
 82  
     }
 83  
 
 84  
     /**
 85  
      * Sets the document type name of the DOCTYPE
 86  
      */
 87  
     public void setName(String name) {
 88  1
         this.name = name;
 89  1
     }
 90  
 
 91  
     /**
 92  
      * Sets the declared public identifier for DTD
 93  
      */
 94  
     public void setPublicId(String class="keyword">publicId) {
 95  1
         this.publicId = publicId;
 96  1
     }
 97  
 
 98  
     /**
 99  
      * Sets the declared system identifier for the DTD
 100  
      */
 101  
     public void setSystemId(String systemId) {
 102  1
         this.systemId = systemId;
 103  1
     }
 104  
 
 105  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.