佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 811|回复: 2

java + webservice

[复制链接]
发表于 3-11-2006 02:26 PM | 显示全部楼层 |阅读模式
我在web service里头得到这样的结果 :
<name />
<address>abcde</adress>

当我在java里头要得到这个web service的结果时为什么我会得到:
name : abcde
address: abcde

我要的是:
name :
address:abcde

百思莫解。。

我的java code:
this.soapMessage_ = this.message_.receive();
XMLReader reader = (XMLReader)Class.forName("org.apache.xerces.parsers.SAXParser" ).newInstance();
SAXHandler handler = new SAXHandler();
String Result = "";
                                               
handler.setElementToSearchFor ("name" );       
reader.setContentHandler (handler);
reader.parse ( new InputSource (new StringReader (this.soapMessage_.getContent().toString() )));
Result += "\nname: " + handler.getResult();
                       
handler.setElementToSearchFor ("address" );       
reader.setContentHandler (handler);
reader.parse ( new InputSource (new StringReader (this.soapMessage_.getContent().toString() )));
strResult += "\naddress: " + handler.getResult();


难道<name>和<name />是一样的哦?
请帮帮忙,谢谢。。

[ 本帖最后由 红卜卜 于 3-11-2006 02:27 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 4-11-2006 11:45 PM | 显示全部楼层
干嘛每次我的问题都没有人帮忙的。。
回复

使用道具 举报

发表于 6-11-2006 02:08 PM | 显示全部楼层
嗨!红卜卜 兄, 我想你的问题出现在你的 XML 那里。试试看这样 <name> </name>。如果不能的话,再贴你的问题上来看看。先祝你成功 +
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 24-9-2024 05:32 AM , Processed in 0.097680 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表