packetExtensionProvider for body part of Message

Hi all,

I’m trying to parse a message sent to my application that looks something like this:

<message to="someagent@somehost.com/someresource" from="some.component.com">
     <body xmlns="http://some-namespace.com/some/some#namespace">
          <status xmlns="">
               <lull>
                    <host>anotherhost.com</host>
                    <value>FINISHED</value>
               </lull>
          </status>
     </body>
</message>

As you can see, the body of the message contains nested elements. When I add a packetExtensionProvider for the elementName body and namespace http://somenamespace/some/some#namespace, my provider’s function parseExtension is not called. I have added the provider with the call to addExtensionProvider like this:

providerManager.addExtensionProvider("body", "http://some-namespace.com/some/some#namespace", new CustomMessageProvider());

My question is:

Is it possible to create a packetExtensionProvider to override the body-part of a message, or can it only be used on new custom stanzas/elements?

Best regards and thank you for your time.

torjeh

I could not find a way to get my provider to register for the body element, so I moved my status element out of the body-part like this:

<message to="someagent@somehost.com/someresource" from="some.component.com">
<body xmlns="http://some-namespace.com/some/some#namespace">
</body>
<status xmlns="http://some-namespace.com/some/some#namespace">
     <lull>
          <host>anotherhost.com</host>
          <value>FINISHED</value>
     </lull>
</status>
</message>

Then I register the provider with:

providerManager.addExtensionProvider("status", "http://some-namespace.com/some/some#namespace", new CustomMessageProvider());

This works as I would expect. All in all it seems better to move the status-element out of the body, but it means that I have to change the code of the clients sending the message and also the other components receiving this message. More work for me

Best regards,

torjeh

Did you try simply putting the status element with the XMLNS inside the body?

Hi rcollier,

Thank you for the excellent suggestion. I don’t know why I didn’t think of that. I probably should have tried that first as it would have made my job easier.

If I find the time to test this I will do so, but I’ve already done the changes I had to do, so I’m not going to change it again now. I will however try and see if it could work, if I can find the time.

Thank you again for the excellent suggestion!

Best regards,

torjeh