Changeset 9812
- Timestamp:
- 2005-05-04T16:09:14+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
r9504 r9812 99 99 public static final String PARAM_IGNORE_POS_ATT = "ignore"; 100 100 public static final String CLASSIFIER_CONTENT_ATT = "content"; 101 101 public static final String ERROR_TYPE_ATT = "type"; 102 102 103 // document stuff 103 104 public static final String DOC_TYPE_ATT = "docType"; … … 173 174 public static final String COMM_TYPE_SOAP_JAVA = "soap"; 174 175 176 // error types 177 public static final String ERROR_TYPE_SYNTAX = "syntax"; 178 public static final String ERROR_TYPE_SYSTEM = "system"; 179 public static final String ERROR_TYPE_INVALID_ID = "invalid_id"; 180 public static final String ERROR_TYPE_OTHER = "other"; 181 175 182 // some system wide param names 176 183 public static final String SUBSET_PARAM = "subset"; … … 279 286 } 280 287 288 /** add an error message, unknown error type */ 289 public static boolean addError(Document owner, Element doc, String text) { 290 return addError(owner, doc, text, ERROR_TYPE_OTHER); 291 } 281 292 /** add an error message */ 282 public static boolean addError(Document owner, Element doc, String text) { 293 public static boolean addError(Document owner, Element doc, String text, 294 String error_type) { 283 295 284 296 Element content = owner.createElement(ERROR_ELEM); 297 content.setAttribute(ERROR_TYPE_ATT, error_type); 285 298 Text t = owner.createTextNode(text); 286 299 content.appendChild(t); … … 291 304 /** add an error message */ 292 305 public static boolean addError(Document owner, Element doc, Throwable error) { 293 error.printStackTrace(); 294 return addError(owner, doc, error.toString()); 306 return addError(owner, doc, error, ERROR_TYPE_OTHER); 307 } 308 309 /** add an error message */ 310 public static boolean addError(Document owner, Element doc, 311 Throwable error, String error_type) { 312 error.printStackTrace(); 313 return addError(owner, doc, error.toString(), error_type); 295 314 } 296 315 … … 402 421 } 403 422 423 public static NodeList getChildrenByTagName(Node n, String name) { 424 MyNodeList node_list = new MyNodeList(); 425 Node child = n.getFirstChild(); 426 while (child!=null) { 427 if (child.getNodeName().equals(name)) { 428 node_list.addNode(child); 429 } 430 child = child.getNextSibling(); 431 } 432 return node_list; 433 } 434 404 435 405 436 /** Duplicates an element, but gives it a new name */
Note:
See TracChangeset
for help on using the changeset viewer.