Coverage Report - org.dozer.loader.xml.SimpleElementReader
 
Classes in this File Line Coverage Branch Coverage Complexity
SimpleElementReader
100%
9/9
100%
4/4
3
 
 1  
 /**
 2  
  * Copyright 2005-2013 Dozer Project
 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.dozer.loader.xml;
 17  
 
 18  
 import org.w3c.dom.Element;
 19  
 import org.w3c.dom.Node;
 20  
 
 21  
 /**
 22  
  * @author Dmitry Buzdin
 23  
  */
 24  9
 public class SimpleElementReader implements ElementReader {
 25  
 
 26  
   public String getAttribute(Element element, String attribute) {
 27  764279
     return element.getAttribute(attribute).trim();
 28  
   }
 29  
 
 30  
   public String getNodeValue(Element element) {
 31  72513
     Node child = element.getFirstChild();
 32  72513
     if (child == null) {
 33  2
       return "";
 34  
     }
 35  72511
     String nodeValue = child.getNodeValue();
 36  72511
     if (nodeValue != null) {
 37  72317
       return nodeValue.trim();
 38  
     } else {
 39  194
       return "";
 40  
     }
 41  
   }
 42  
 
 43  
 }