android 编写xml文件夹,我如何编写XML文件中的android

usning XMLStreamWriter想在这里创建的XML文件是我下面的代码我如何编写XML文件中的android

String fileName = "jasstech.xml";

XMLOutputFactory xof = XMLOutputFactory.newInstance();

XMLStreamWriter xtw = null;**

try

{

xtw = xof.createXMLStreamWriter(new FileOutputStream(fileName), "UTF-8");

xtw.writeStartDocument("UTF-8", "1.0");

xtw.writeStartElement("root");

xtw.writeComment("This is an attempt to create an XML file with StAX");

xtw.writeStartElement("foo");

xtw.writeAttribute("order", "1");

xtw.writeStartElement("meuh");

xtw.writeAttribute("active", "true");

xtw.writeCharacters("The cows are flying high this Spring");

xtw.writeEndElement();

xtw.writeEndElement();

xtw.writeStartElement("bar");

xtw.writeAttribute("order", "2");

xtw.writeStartElement("tcho");

xtw.writeAttribute("kola", "K");

xtw.writeCharacters("Content of tcho tag");

xtw.writeEndElement();

xtw.writeEndElement();

xtw.writeEndElement();

xtw.writeEndDocument();

}

catch (XMLStreamException e)

{

e.printStackTrace();

}

catch (IOException ie)

{

ie.printStackTrace();

}

以上 相同的代码工作正常,在Java项目 但在Android的项目为以下错误

03-03 07:48:40.778: ERROR/AndroidRuntime(719): Uncaught handler: thread main exiting due to uncaught exception

03-03 07:48:40.788: ERROR/AndroidRuntime(719): com.kochar.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxOutputFactory not found

03-03 07:48:40.788: ERROR/AndroidRuntime(719): at com.kochar.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:23)

2011-03-03

Karan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值