Thanks to earlier help, I'm happily parsing the ugly-chunky 'special' element that I have to handle in my tests. But it's requireing ugly-chunky code because it has to deal with all kinds of child elements. So I figured I'd break out the child elements into their own custom extensions. The trouble (I think) is that these child elements do not have an explicit namespace. By XML rules, they do have a namespace (it comes from the outermost element containing the child) but that doesn't seem to be seen when parsing at that depth. First, the XML in question -- the focus is on the <address> elements inside <content> element (not the similar RFC-033 <addresses> block.
<message to="multicast.gocortext.com" type="chat" from="tdka4c5ba62691f4@gocortext.com" id="eb0bbea0-487d-11e2-9c3b-58b035f3b7bb">
<body>1</body>
<thread>5a5a27d4-487d-11e2-8468-58b035f3b7bb</thread>
<domain xmlns="http://imprivata.com/protocol/cortext">qa.imprivata.com</domain>
<addresses xmlns="http://jabber.org/protocol/address">
<address jid="dkashtan.1@gocortext.com" type="to" />
<address jid="tdkaa32cd44bbbf9@gocortext.com" type="to" />
</addresses>
<content xmlns="http://imprivata.com/protocol/cortext" mime-type="application/x-cortext-group-message">
<from domain="qa.imprivata.com" name="test dkashtan.2">tdka4c5ba62691f4@gocortext.com</from>
<domain name="mpgQA">qa.imprivata.com</domain>
<addresses>
<address jid="dkashtan.1@gocortext.com" name="dkashtan.1" />
<address jid="tdkaa32cd44bbbf9@gocortext.com" name="dkashtan.3" />
<address jid="tdka4c5ba62691f4@gocortext.com" name="dkashtan.2" />
</addresses>
</content>
</message>
Current State:
* A default extension is created for the RFC-033 <addresses> element but not for <address> elements inside it. So I don't think there is a clash there.
* In my current provider for <content>, as I iterate over the elements my <address> element does have the namespace I expect. Because it is contained inside of a <content> element with the namespace http://imprivata.com/protocol/cortex, it has that namespace.
* Provider is registered in code via:
ProviderManager pm = ProviderManager.getInstance();
pm.addExtensionProvider("content", XMLConstants.AV_CORTEXT_NAMESPACE, new ContentExtension.Provider());
pm.addExtensionProvider("domain", XMLConstants.AV_CORTEXT_NAMESPACE, new DomainExtension.Provider());
pm.addExtensionProvider("domain", "jabber:client", new CalvinDomainExtension.Provider());
pm.addExtensionProvider("address", XMLConstants.AV_CORTEXT_NAMESPACE, new CortextAddressExtension.Provider());
It is the last one.
Problem continued in next post...