1 16 17 package xni; 18 19 import org.apache.xerces.xni.Augmentations; 20 import org.apache.xerces.xni.QName; 21 import org.apache.xerces.xni.XMLAttributes; 22 import org.apache.xerces.xni.XNIException; 23 24 37 public class UpperCaseFilter 38 extends PassThroughFilter { 39 40 44 50 private final QName fQName = new QName(); 51 52 56 64 public void startElement(QName element, XMLAttributes attributes, Augmentations augs) 65 throws XNIException { 66 super.startElement(toUpperCase(element), attributes, augs); 67 } 69 77 public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) 78 throws XNIException { 79 super.emptyElement(toUpperCase(element), attributes, augs); 80 } 82 89 public void endElement(QName element, Augmentations augs) 90 throws XNIException { 91 super.endElement(toUpperCase(element), augs); 92 } 94 98 105 protected QName toUpperCase(QName qname) { 106 String prefix = qname.prefix != null 107 ? qname.prefix.toUpperCase() : null; 108 String localpart = qname.localpart != null 109 ? qname.localpart.toUpperCase() : null; 110 String rawname = qname.rawname != null 111 ? qname.rawname.toUpperCase() : null; 112 String uri = qname.uri; 113 fQName.setValues(prefix, localpart, rawname, uri); 114 return fQName; 115 } 117 } | Popular Tags |