How to branch on root element of an XML Node

I have an MQ Series queue from which I read messages that may be of several different types. Each type of message has its own XML root element. So what I would like to be able to do is:

  1. invoke xmlStringToXMLNode
  2. branch on the root element of the XML document
  3. invoke xmlNodeToDocument to “cast” the incoming message to a reference to the appropriate one of eight or ten different webMethods document types.

But I cannot figure out how to introspect the XML when it is a “node”.

There is a service that you can use to get the XML root node. I think it is called getDocumentType. From there, you can use a branch statement and transform the node to the specific record type.

You can use the XQL query //baseName() to get the name of the root node. Other related queries are //prefix() to return the prefix of the root node and /*/namespace() to return the namespace name.