Code example for CharArrayReader

0
        } 
 
        //System.out.println(charBuff); 
 
        // Parse XML 
        CharArrayReader car = new CharArrayReader(charBuff, 0, in_buff); // these two lines have to be here.
        BufferedReader br_car = new BufferedReader(car);
 
        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setValidating(true);
 
        XMLReader xmlReader = null;
        SAXParser saxParser = spf.newSAXParser();
        xmlReader = saxParser.getXMLReader();
 
        // Set the ContentHandler of the XMLReader 
        MyXMLHandler handler = new MyXMLHandler( metricName );
        xmlReader.setContentHandler(handler);
 
        // Set an ErrorHandler before parsing 
        // xmlReader.setErrorHandler(new MyErrorHandler(System.err));