Some simple examples of using Erlang’s XPath implementation

We’ve been investigating the possibility of an XPath-based routing extension to RabbitMQ, where XPath would be used as binding patterns, and the message structure would be exposed as XML infoset. As part of this work, we’ve been looking at Erlang’s XPath implementation that comes as part of the built-in xmerl library.

Here are a couple of examples of Erlang’s XPath in action. First, let’s parse a document to be queried:

We should experiment with adding it to RabbitMQ first, and making sure the design is sound – and once we have a solid, implementation-neutral proposal, we can ask the AMQP working group what they think of the idea. A proven, implemented idea has much greater chance of being accepted.

@Sopwith Camel: Good point. XDM is a richer model than Infoset. I’m not sure the cost would be significantly different, but there’s certainly an expressivity win. On the other hand, I don’t particularly fancy implementing XPath 2.0