Help understanding PubSub and namespaces?

Hi,

I need some help understanding how namespaces work in relation to PubSub.

Problem:

I’ve created an XML schema with various types of objects that I’d like my clients to be able to publish via PubSub. I’m not sure how to associate my schema and traditional XML namespaces with the PubSub schemas.

Example:

I’ve created a custom “Location” object, described as:

<xsd:complexType name=“LocationType”>

 <xsd:attribute name="latitude" type="xsd:double" use="required"></xsd:attribute>
 <xsd:attribute name="longitude" type="xsd:double" use="required"></xsd:attribute>

</xsd:complexType>

When reading or writing the XML, I use proper namespace syntax like this:

<tns:Location xmlns:tns=“http://seattle1.adspore.com/schema/types” latitude=“42.75663” longitude="-122.4837374"></tns:Location>

I have the ability to control the “tns” prefix, the document writer makes the association between the “http://…” url and the “prefix” where appropriate.

Question:

How should this be handled within Smack and Openfire? When I observe the nodes in the Openfire database rows, the “http://seattle1…” portion is actually the node id. This doesn’t look correct.

Any help understanding would be very helpful, there just are not enough examples for me to understand how this works.

Thanks,

DD

The namespace and schema of your custom data has no relationship to pubsub. The server will simply store whatever is embedded within an item tag of the publish request. If the url you have shown is showing as the node id, then it was set as the node id when the node was created and published. The server does not parse the contents of the item element.

The only place your own namespace would be used is if you create and register a custom PacketExtensionProvider with the ProviderManager. This simply maps your root element and namespace to code that can parse it into something meaningful to your own application.