在下面的代码“expatparser parseexception”中获取异常

时间:2012-10-15 08:27:39

标签: java android

我将android 2.2的运行代码转换为android 4.0,但现在我得到了一个expatparser parseexception。

try {    
   String xmls = LoginActivity.xml;
   SAXParserFactory saxPF = SAXParserFactory.newInstance();
   SAXParser saxP = saxPF.newSAXParser();
   XMLReader xmlR = saxP.getXMLReader();

   XMLHandler myXMLHandler = new XMLHandler();
   xmlR.setContentHandler(myXMLHandler);
   InputStreamReader isr = new InputStreamReader(
     new ByteArrayInputStream(xmls.getBytes("UTF-8")));
   xmlR.parse(new InputSource(isr));

  } catch (Exception e) {
   System.out.println(e);
  }

0 个答案:

没有答案