powered by Jive Software

Create custom xml packets with custom attribute tag

I need to create a packet like this:

body

22_84

0

0

can I use a defaultPacketExtension?

thanks

can someone give me a suggestion?

I don’t think so, you will have to use a custom extension to support that particular format as the DefaultPacketExtension will not support attributes.

You could do something more like this with that class.

22_84

2

52.46

101.38

207.17

271.16

0

:

:

But that gets kind of ugly pretty quickly. For any complex structure you should just create your own extension and provider.

Thankyou rcollier for the answer.

could you do me a small example?

there is little documentation and few examples.

The source code is good documented and there are many live and in-use examples of Extensions and Providers. For example

  • Vcard Provider
  • Vcard Extension

I would also recommend using the EmbeddedExtensionProvider where appropriate as it will make the parsing a little easier.

There are examples of its usage in the pubsub packages, along with the associated extensions.

I set the provider (ProviderManager.getInstance().addExtensionProvider( “mbAction”, “jabber:client”, new MyPEP());), but the response message is not parsed.

where the error might be?

thanks again

Fixed.

Thanks