Asmack 未加载 VCard
我正在使用 Asmack 的二进制版本(我将在有时间的情况下尽快构建它,因为我第一次尝试时遇到了问题)。我还建立了自己的 ejabberd 服务器。
当我尝试加载一些联系人 VCard 时,服务器返回信息,但 Asmack 似乎不喜欢它(或无法解析它)。
这是我在调试模式下可以看到的:
<iq from='user@domain' to='admin@domain/Smack' id='I17sI-4' type='result'>
<vCard xmlns='vcard-temp' prodid='-//HandGen//NONSGML vGen v1.0//EN' version='2.0'>
<FN>Full Name</FN>
<N>
<FAMILY>Surname</FAMILY>
<GIVEN>Nick</GIVEN>
</N>
<NICKNAME>Nickname</NICKNAME>
<URL>http://google.com</URL>
<ADR>
<LOCALITY>lanta</LOCALITY>
<REGION>krabi</REGION>
<PCODE>81150</PCODE>
<CTRY>thailand</CTRY>
</ADR>
<EMAIL>
<USERID>[email protected]</USERID>
</EMAIL>
</vCard>
</iq>
但是当我这样做时,
VCard card = new VCard();
card.load(xmppConn, "user@domain");
所有信息都设置为 null,当我尝试通过调用 VCard.toXML() 方法查看 XML 时,我只是得到一个像这样的空 XML
<iq id="I17sI-4" to="user@domain" type="get"><vCard xmlns='vcard-temp'/></iq>
所以任何人都知道我做错了什么或者这个二进制版本无法解析从服务器收到的 VCard?
I am using a binary release of Asmack (I will be building it as soon as I have some time as I had problems the first time I tried). I also set up my own ejabberd server.
When I try to load some contact VCard the server returns the info but Asmack does not seem to like it (or fail to parse it).
This is what I can see in debug mode:
<iq from='user@domain' to='admin@domain/Smack' id='I17sI-4' type='result'>
<vCard xmlns='vcard-temp' prodid='-//HandGen//NONSGML vGen v1.0//EN' version='2.0'>
<FN>Full Name</FN>
<N>
<FAMILY>Surname</FAMILY>
<GIVEN>Nick</GIVEN>
</N>
<NICKNAME>Nickname</NICKNAME>
<URL>http://google.com</URL>
<ADR>
<LOCALITY>lanta</LOCALITY>
<REGION>krabi</REGION>
<PCODE>81150</PCODE>
<CTRY>thailand</CTRY>
</ADR>
<EMAIL>
<USERID>[email protected]</USERID>
</EMAIL>
</vCard>
</iq>
But when I do
VCard card = new VCard();
card.load(xmppConn, "user@domain");
All the info is set to null, and when I try to look at the XML by calling VCard.toXML() method I just got an empty XML like this
<iq id="I17sI-4" to="user@domain" type="get"><vCard xmlns='vcard-temp'/></iq>
So anyone knows what I am doing wrong or if this binary release that fails to parse the VCard received from the server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在加载 vCard 之前添加行:
ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp", new VCardProvider());
。Add line:
ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp", new VCardProvider());
before loading vCard.