powered by Jive Software

Problem with VCard


i have problems using the VCard extension esspecially with the telephone numbers …

the JEP-0054 at http://www.jabber.org/jeps/jep-0054.html gives an example like:

when i try to set the NUMBER field …

and … it seams the parsing isn’'t quite working too … because:

Fatal Error] :6:7: The content of elements must consist of well-formed character data or markup.

FEHLER: ‘‘The content of elements must consist of well-formed character data or markup.’’

org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity( Unknown Source)

  • Transformation error

org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.formatXML(EnhancedDebugger.ja va:746)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.addReadPacketToTable(Enhanced Debugger.java:660)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.access$000(EnhancedDebugger.j ava:51)

at org.jivesoftware.smackx.debugger.EnhancedDebugger$1.processPacket(EnhancedDebug ger.java:161)

at org.jivesoftware.smack.PacketReader$ListenerWrapper.notifyListener(PacketReader .java:681)

at org.jivesoftware.smack.PacketReader.processListeners(PacketReader.java:248)

at org.jivesoftware.smack.PacketReader.access$100(PacketReader.java:42)

at org.jivesoftware.smack.PacketReader$2.run(PacketReader.java:71

it seams String code = node.getFirstChild().getNodeName();

in VCardProvider.java in line 132 returns #text

… maybe there is a check missing if the first child is a tag or just a text ?

Somehow it seams the whole VCard JEP is mess (e.g. FN (fullname) and firstname,middlename,lastname are all fields… ??) … anyone knows if there exists a newer JEP which will replace vCards ?

thx & cu

Herbert Poul


I guess you should set VOICE field, not NUMBER.

erm… when i set the VOICE field … the number will bei in the tag

but i would like to generate XML similar to the example in the JEP … (and … one which is compatible with other clients) …

Did you try to set VOICE field?

It should work according to JEP. At least I implemented VCard support this way.

yes, and i’‘ve used it now that way … but it isn’'t compatible with PSI …

i haven’‘t tried any other clients, since i’'m only using this one … (did you try any other client ?)

it’‘s not a big problem … but since it would only require 1 line of code to be added to make it work (ie. test if the NUMBER field is set, before writing ) i think it’'s worth the effort …

Sorry, I’‘m afraid I didn’'t catch you. What is wrong with the current Smack VCard implementation? It should currently work according to JEP. How PSI VCards look like?

I’‘d be happy to help, but I don’'t see the problem so far …

OMG sorry … i haven’'t looked at it for too long …

i don’‘t know why i wasn’'t able to get it to work the first time …

i imagined that when setting “VOICE” with the number it resulted in … but it’‘s not the case… sorry … i have no idea why I haven’'t done that in the first place

thx for pointing out that i’'m completely wrong…

but … one thing tough … i’‘m now able to create a VCard with a telephone number which is viewable in PSI … but … not the other way round … i’‘ve mentioned it in my first post that there is a problem with parsing … i’‘m not able to retrieve the telephone number, some other things work, some don’'t …

i’'ve again looked at the code. .and the error seams to be here:

String code = node.getFirstChild().getNodeName();

String value = getTextContent(node.getChildNodes().item(2));

node.getFirstChild() has as data \n … and the name returns #text

i can’‘t imagine how i’'m doing something wrong this time … because the error happens by just calling:

VCard newVCard = new VCard();

newVCard.load(account.xmpp.getConnection(), user);

any suggestions ?

and … if it helps … here is my vcard you can also try to request the vcard from me: kahless@sphene.net in your smack application or a test application:


I’'ve sent you fixes for the VCard implementation via E-mail. Hope, the fixes will be incorporated into the main codebase soon.

Happy NY!

Kind regards,