public MaterialList load(AssetManager assetManager, String folderName, InputStream in) throws IOException {
        try {
            this.assetManager = assetManager;
            this.folderName = folderName;
            
            reset();
            
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setNamespaceAware(true);  
            XMLReader xr = factory.newSAXParser().getXMLReader();  

            xr.setContentHandler(this);
            xr.setErrorHandler(this);

            InputStreamReader r = null;

            try {
                r = new InputStreamReader(in);
                xr.parse(new InputSource(r));
            } finally {
                if (r != null){
                    r.close();
                }
            }
            
            return materialList;
        } catch (SAXException | ParserConfigurationException ex) {
            IOException ioEx = new IOException("Error while parsing Ogre3D dotScene");
            ioEx.initCause(ex);
            throw ioEx;
        }
    }
This is a utility class to load a {@link MaterialList} from a 
.scene file. It is only needed because the parsing method
used by the SceneLoader doesn't support reading bottom XML nodes
before reading the top nodes.

@author Kirill Vainer
jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SceneMaterialLoader.java