Code example for CharArrayReader

        // 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();
        XMLReader xmlReader = null;
        SAXParser saxParser = spf.newSAXParser();
        xmlReader = saxParser.getXMLReader();
        // Set the ContentHandler of the XMLReader 
        MyXMLHandler handler = new MyXMLHandler( metricName );
        // Set an ErrorHandler before parsing 
Contextual code suggestions in your IDE  Get Codota for Java