KXMl中解决中文乱码问题
public void verifyCredentials() throws Exception
{
InputStream is ;
HttpConnection hc = (HttpConnection) Connector.open(url);
try
{
int stateCode = hc.getResponseCode();
if(stateCode==200)
{
is = hc.openInputStream();
InputStreamReader in = new InputStreamReader(is,"UTF-8");
XmlParser parser = new XmlParser(in);
boolean parsing = true; //判断是否到达最后一个document标签
while(parsing)
{
ParseEvent event = parser.read();//
switch(event.getType())
{
case Xml.START_TAG : //处理开始标签tag
System.out.println("处理开始标签");
System.out.println("Tagname--"+((StartTag)event).getName()); //
break;
case Xml.END_TAG : //处理结束标签tag
System.out.println("处理结束标签111");
System.out.println("Tagname--"+event.toString());
break;
case Xml.END_DOCUMENT : //处理开始标签tag
System.out.println("结束处理标签,退出程序222222");
System.out.println("Tagname--"+event.toString());
parsing = false;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>