Code example for SAXParser

Methods: getXMLReader

0
	public TexturePack load(final AssetManager pAssetManager, final InputStream pInputStream) throws TexturePackParseException {
		try{ 
			final SAXParserFactory spf = SAXParserFactory.newInstance();
			final SAXParser sp = spf.newSAXParser();
 
			final XMLReader xr = sp.getXMLReader();
			final TexturePackParser texturePackerParser = new AssetTexturePackParser(this.mTextureManager, pAssetManager, this.mAssetBasePath);
			xr.setContentHandler(texturePackerParser);
 
			xr.parse(new InputSource(new BufferedInputStream(pInputStream)));
 
			return texturePackerParser.getTexturePack();
		} catch (final SAXException e) {
			throw new TexturePackParseException(e);
		} catch (final ParserConfigurationException pe) {
			/* Doesn't happen. */ 
			return null; 
		} catch (final IOException e) {
			throw new TexturePackParseException(e);
		} finally { 
			StreamUtils.close(pInputStream);