Hi all, I’m glad to join this community.
I’m developing a multi-user chat tool for Agile Planning and I’m using Smack 3.1
My problem is the follow: when I try to send this packet extension:
<backlog xmlns='http://cdg.di.uniba.it/xcore/jabber'>
<story>
<story-name>Name_content</story-name>
<description>Description_content</description>
<priority>HIGH</priority>
<estimate>UNKNOW</estimate>
</story>
</backlog>
I get the following exception:
org.xmlpull.v1.XmlPullParserException: parser must be on START_TAG or TEXT to read text (position: START_TAG seen ...og xmlns="http://cdg.di.uniba.it/xcore/jabber"><story><story-name>... @1:2169) at org.xmlpull.mxp1.MXParser.nextText(MXParser.java:1071)
at org.jivesoftware.smack.util.PacketParserUtils.parseWithIntrospection(PacketParserUtils.java:435)
at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParserUtils.java:381)
at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.java:107)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:272)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)
After a number of proof, it seems that there is a problem in the xml namespace. If i remove the : (colon) from xml namespace I don’t get the exception. I don’t if it does matter, but I don’t think that is the only solution.
This is the toXML method implementation of the PacketExtension:
@Override
public String toXML() {
String xml = String.format("<%s xmlns=\"%s\">" , "backlog", "http://cdg.di.uniba.it/xcore/jabber");
for(int i=0; i < backlog.getUserStories().length; i++){
SimpleUserStory story = (SimpleUserStory) backlog.getUserStories()[i];
xml+=String.format("<%s>", "story");
xml+=String.format("<%s>%s</%s>", "name",StringUtils.escapeForXML(story.getName()),"name" );
xml+=String.format("<%s>%s</%s>", "description", StringUtils.escapeForXML(story.getDescription()), "description");
xml+=String.format("<%s>%s</%s>", "priority", StringUtils.escapeForXML(story.getPriority().toString()), "priority");
xml+=String.format("<%s>%s</%s>", "estimate", StringUtils.escapeForXML(story.getEstimate().toString()), "estimate");
xml+=String.format("</%s>", "story");
}
xml += String.format("</%s>", "backlog");
return xml;
}
I will appreciate any kind of feedback,
Alessandro.