XStream XmlPullParserException

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 10:22:46

Make sure you have included all the jars that come with XStream also specially "kxml2.jar" and "xmlpull-1.1.3.1.jar" file. Jar version may deffer incase of yours.

Kalpesh Soni

Use

new XStream(new StaxDriver())

xpp and xmlpull are very old codebases

with non-default constructor you could avoid those 2 jars

You can too use :

new XSteam(new DomDriver())

The difference with StaxDriver is the output of convert objet to xml.

Output DomDriver :

<person>
  <firstname>Joe</firstname>
  <lastname>Walnes</lastname>
  <phone>
    <code>123</code>
    <number>1234-456</number>
  </phone>
  <fax>
    <code>123</code>
    <number>9999-999</number>
  </fax>
</person>

Output StaxDriver :

<?xml version="1.0" ?><person><firstname>Joe</firstname><lastname>Walnes</lastname><phone><code>123</code><number>1234-456</number></phone><fax><code>123</code><number>9999-999</number></fax></person>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!