コード例 #1
0
 public bool Match(org.w3c.dom.Element element) {
    if(element != null) {
       String attribute = element.getAttribute(name);
       return attribute != null && attribute.equals(value);
    }
    return false;
 }
コード例 #2
0
 public bool Match(org.w3c.dom.Element element, String prefix) {
    if(element != null) {
       String currentPrefix = GetPrefix(element); // if prefix is null, then this is inherited
       if((currentPrefix != null && prefix == null) ) {
          prefix = currentPrefix; // inherit parents
       }
       String name = "xmlns"; // default xmlns=<reference>
       if(prefix != null && !prefix.equals("")) {
          name = name + ":" + prefix; // xmlns:a=<reference>
       }
       String value = element.getAttribute(name);
       if(value == null || value.equals("")) {
          Node parent = element.getParentNode();
          if(parent instanceof org.w3c.dom.Element) {
             return Match((org.w3c.dom.Element)element.getParentNode(), prefix);
          }
       }
       return value != null && value.equals(reference);
    }
    return false;
 }