Package jp.aonir.fuzzyxml.util

Source Code of jp.aonir.fuzzyxml.util.ElementFilter

package jp.aonir.fuzzyxml.util;

import jp.aonir.fuzzyxml.FuzzyXMLElement;
import jp.aonir.fuzzyxml.FuzzyXMLNode;

public class ElementFilter implements NodeFilter {
 
  private String name;
 
  public ElementFilter(){
    this(null);
  }
 
  public ElementFilter(String name){
    this.name = name;
  }
 
  public boolean filter(FuzzyXMLNode node) {
    if(node instanceof FuzzyXMLElement){
      FuzzyXMLElement element = (FuzzyXMLElement)node;
      if(name!=null && !name.equals(element.getName())){
        return false;
      }
      return true;
    }
    return false;
  }

}
TOP

Related Classes of jp.aonir.fuzzyxml.util.ElementFilter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.