FileDocCategorySizeDatePackage
UpperCaseFilter.javaAPI DocApache Xerces 3.0.14016Fri Sep 14 20:33:56 BST 2007xni

UpperCaseFilter

public class UpperCaseFilter extends PassThroughFilter
This sample demonstrates how to create a filter for the document "streaming" information set that turns element names into upper case.

Note: This sample does not contain a main method and cannot be run. It is only for demonstration purposes.

author
Andy Clark, IBM
version
$Id: UpperCaseFilter.java 447690 2006-09-19 02:41:53Z mrglavas $

Fields Summary
private final org.apache.xerces.xni.QName
fQName
Temporary QName structure used by the toUpperCase method. It should not be used anywhere else.
Constructors Summary
Methods Summary
public voidemptyElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
An empty element.

param
element The name of the element.
param
attributes The element attributes.
throws
XNIException Thrown by handler to signal an error.

        super.emptyElement(toUpperCase(element), attributes, augs);
    
public voidendElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.Augmentations augs)
The end of an element.

param
element The name of the element.
throws
XNIException Thrown by handler to signal an error.

        super.endElement(toUpperCase(element), augs);
    
public voidstartElement(org.apache.xerces.xni.QName element, org.apache.xerces.xni.XMLAttributes attributes, org.apache.xerces.xni.Augmentations augs)
The start of an element.

param
element The name of the element.
param
attributes The element attributes.
throws
XNIException Thrown by handler to signal an error.


    //
    // XMLDocumentHandler methods
    //
    
                                       
           
          
        super.startElement(toUpperCase(element), attributes, augs);
    
protected org.apache.xerces.xni.QNametoUpperCase(org.apache.xerces.xni.QName qname)
This method upper-cases the prefix, localpart, and rawname fields in the specified QName and returns a different QName object containing the upper-cased string values.

param
qname The QName to upper-case.

        String prefix = qname.prefix != null
                      ? qname.prefix.toUpperCase() : null;
        String localpart = qname.localpart != null
                         ? qname.localpart.toUpperCase() : null;
        String rawname = qname.rawname != null
                       ? qname.rawname.toUpperCase() : null;
        String uri = qname.uri;
        fQName.setValues(prefix, localpart, rawname, uri);
        return fQName;