Add custom attribute to Presence Message

Hi, I have to manage presence message like this:

**<presence xmlns="…" **

** to="…" **

** attribute1="—"**

** attribute2="…"**

** attribute3="…"
**

** from="…">**

Attributes that interest me are in the “presence” tag.

how can I do?

Can I extends Presence class? In this way I might add custom attribute to presence.

But when I receive a message of what kind is it?

IMHO adding custom attributes to an element specified by the protocol is the wrong approach. You should add an extra element with your attributes.