Example usage for org.xml.sax.helpers XMLReaderFactory createXMLReader

List of usage examples for org.xml.sax.helpers XMLReaderFactory createXMLReader

Introduction

In this page you can find the example usage for org.xml.sax.helpers XMLReaderFactory createXMLReader.

Prototype

public static XMLReader createXMLReader() throws SAXException 

Source Link

Document

Obtains a new instance of a org.xml.sax.XMLReader .

Usage

From source file:tv.acfun.video.player.resolver.SinaResolver.java

@Override
public void resolve(Context context) throws ResolveException {
    // TODO Auto-generated method stub
    try {//from  w  w w. ja  v a 2  s  .  co  m
        if (mResolutionMode < RESOLUTION_HD2) {
            vid = getSinaMp4Vid(vid);
            Log.i(TAG, "sina mp4 mode");
        }
        String url = getContentUrl(vid);
        Log.i(TAG, "sina video url = " + url);
        InputStream stream = getResponseAsStream(url);
        XMLReader xmlReader = XMLReaderFactory.createXMLReader();
        ContentHandler contentHandler = new UrlContentHandler();
        xmlReader.setContentHandler(contentHandler);
        xmlReader.parse(new InputSource(stream));
    } catch (Exception e) {
        throw new ResolveException(e);
    }
}