Changeset 30666
- Timestamp:
- 2016-08-04T11:41:02+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r30629 r30666 140 140 public static final String LANG_ATT = "lang"; 141 141 public static final String KEY_ATT = "key"; 142 public static final String DICTIONARY_ATT = "dictionary"; 142 143 public static final String HREF_ATT = "href"; 143 144 public static final String TYPE_ATT = "type"; … … 1047 1048 } 1048 1049 1049 /** returns the element parent/node_name[@attribute_name='attribute_value'] */ 1050 /** returns the element parent/node_name[@attribute_name='attribute_value'] 1051 if attribute_value is null, just returns the first one with that attribute */ 1050 1052 public static Element getNamedElement(Element parent, String node_name, String attribute_name, String attribute_value) 1051 1053 { … … 1057 1059 if (child.getNodeName().equals(node_name)) 1058 1060 { 1059 if (((Element) child).getAttribute(attribute_name).equals(attribute_value)) 1060 return (Element) child; 1061 } 1062 } 1061 String att_val = ((Element) child).getAttribute(attribute_name); 1062 if (!att_val.equals("") ) { 1063 if (attribute_value == null || att_val.equals(attribute_value)) { 1064 return (Element) child; 1065 } 1066 } 1067 } 1068 } // for each child 1063 1069 // not found 1064 1070 return null;
Note:
See TracChangeset
for help on using the changeset viewer.