01: /**
02: *
03: * © Copyright International Business Machines Corporation 2006.
04: * All rights reserved.
05: *
06: * The 'Helpers' class provides a helper function.
07: *
08: * File : Helpers.java
09: * Created : 2006/08/17
10: *
11: * @author Rene Pawlitzek (rpa@zurich.ibm.com)
12: * @version 1.00, 2006/08/17
13: * @since JDK 1.3
14: *
15: * History : 2006/08/17, rpa, new file
16: * 2006/08/18, rpa, code review
17: *
18: */package com.ibm.hamlet.helpers;
19:
20: import org.xml.sax.*;
21: import org.xml.sax.helpers.*;
22:
23: public class Helpers {
24:
25: public static Attributes getAttributes(Attributes atts,
26: String attrName, String attrValue) {
27: AttributesImpl atts2 = new AttributesImpl(atts);
28: int index = atts2.getIndex(attrName);
29: if (attrValue != null)
30: if (index != -1)
31: atts2.setValue(index, attrValue);
32: else
33: atts2.addAttribute("", attrName, attrName, "CDATA",
34: attrValue);
35: else
36: atts2.removeAttribute(index);
37: return atts2;
38: } // getAttributes
39:
40: } // Helpers
41:
42: /* ----- End of File ----- */
|