XSLT is to XML as <WHAT> is to Protocol Buffers? Is there a transform for Google Protocol Buffer data?

Viewed 92

This is NOT a question about XML! This is a question about transforming binary data in a Google Protocol Buffer.

Let's say I have two .proto's generating two different "Messages". Imagine that in the one message all the units are metric, in the other they are all English. Aside from that names are all capitalized in the one and not the other.. and so on, and so on.

Now my question is: How can I generically transform protocol buffer data in place WITHOUT either: (1) writing custom implementation to access a field in object A only to process it and mutate it into object B, or (2) pulling the data out of the proto namespace and paradigm (eg: stream to xml).

So far my solution has been moving data from protocol buffers through Xerces, transforming in Xalan and then streaming back into another object. Painful, clunky, slow.

1 Answers

Quite simply: there isn't anything comparable pre-existing of which I am aware. In theory something could be possible using the reader/writer APIs (for whichever platform you're targeting), but it still wouldn't be trivial, especially in the treatment of sub-objects.

It could be interesting to investigate such a transformation API, but I don't imagine it is going to be common-place enough to warrant anything as advanced as xslt.

Related