Changeset 3618


Ignore:
Timestamp:
2002-12-03T16:22:50+13:00 (21 years ago)
Author:
say1
Message:

added methods to insert errors into XML

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r3600 r3618  
    3232    public static final String CONFIGURE_ELEM = "configure";
    3333    public static final String STATUS_ELEM = "status";
     34    public static final String ERROR_ELEM = "error";
    3435    public static final String DEFAULT_ELEM = "default";
    3536    // elems for the pages to be processed by xslt
     
    226227    return true;
    227228    }
     229 
     230    /** add an error message */
     231    public static boolean addError(Document owner, Element doc, String text) {
     232
     233    Element content = owner.createElement(ERROR_ELEM);
     234    Text t = owner.createTextNode(text);
     235    content.appendChild(t);
     236
     237    return true;
     238    }
     239
     240    /** add an error message */
     241    public static boolean addError(Document owner, Element doc, Throwable error) {
     242      error.printStackTrace();
     243      return addError(owner, doc, error.toString());
     244    }
     245
    228246    /** adds an empty MetadataList elem to a doc, and returns a ref to it*/
    229247    public static Element addMetaList(Document owner, Element doc) {
Note: See TracChangeset for help on using the changeset viewer.