开发者

class cast exception on using xmlresouceparser with Document

开发者 https://www.devze.com 2023-04-01 11:59 出处:网络
Hi all i have a class cast exception, No idea what is this, Can any one help on this XmlResourceParser fXmlFile = mn.getResources().getXml(R.layout.savecredentials);

Hi all i have a class cast exception, No idea what is this, Can any one help on this

XmlResourceParser fXmlFile = mn.getResources().getXml(R.layout.savecredentials);
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            Document doc = docBuilder.parse((InputStream) fX开发者_如何学JAVAmlFile); //exception is on //this line


You're casting an XmlResourceParser

XmlResourceParser fXmlFile = mn.getResources().getXml(R.layout.savecredentials);

to an InputStream:

docBuilder.parse((InputStream) fXmlFile);
0

精彩评论

暂无评论...
验证码 换一张
取 消