title: Using XMLFilterImpl getting the characters values in the XML
body: <p>I have written code for reading one xml and filter for unwanted tags and write a new xml.I am able to filter the wanted Tags with values but not able to filter the unwanted tags values.</p>
  
  <p>Code :</p>
  
  <p>public static void main(String[] args) throws Exception {</p>
  
  <pre><code>    XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) {
  
          public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
  
              if (qName.equals("COLLECTION") || qName.equals("Transaction") || qName.equals("CreatedDate")
                     ) {
  
                  super.startElement(uri, localName, qName, atts);
              }
          }
  
          public void endElement(String uri, String localName, String qName) throws SAXException {
              if (qName.equals("COLLECTION") || qName.equals("Transaction") || qName.equals("CreatedDate")){
  
                  super.endElement(uri, localName, qName);
              }
          }
  
          public void characters(char ch[], int start, int length) throws SAXException {
  
  
                  super.characters(ch, start, length);
  
  
  
          }
      };
      Source src = new SAXSource(xr, new InputSource("/xml"));
      Result res = new StreamResult(System.out);
  
      TransformerFactory.newInstance().newTransformer().transform(src, res);
  
  }
  </code></pre>