Generating the definition of protocol buffers
I have a large set of proprietary schema XML files - XML ββfiles define a binary communication protocol (message structure).
I would like to use google protocol buffer technology.
I am using existing code to load XML files into the object model (in memory). I would like to generate a .proto file from this object model.
so I'm basically looking for a code / library (in C # /. NET) that exposes the .proto file format as an object model and can save that object model to a .proto file.
I looked at Jon Skeet dotnet-protobufs, I think I understand what it does (generate C # code based on .proto files)
However, I didn't understand if I could use it for my project (there is probably a .proto object model in there, but probably only code that can parse this format and not write it)
source to share
protobuf-net (my .NET version of protocol buffers) has primitive support for generating proto files, but it wouldn't be easy to fill in the blanks. I first focused on the main core and then on C # with proto. Writing xslt to create a proto from an object model won't be much different. It will take a few days though ... (I have a limited time at the moment).
If this would be helpful please let me know.
For information, the protobuf-net engine is compatible with most XmlSerializer
classes (and DataContractSerializer
more recently BinaryFormatter
) - so if your code is currently running as xml, we can probably get it to work on the protobuf-net. No guarantees, of course ...
source to share
My code can only be serialized and deserialized in binary and text. However, I believe Mark Gravell's project has XML capabilities. In fact, I believe it generates C # code based on loading the binary version of the .proto file (which itself is encoded as protobuf), writing it as XML and then applying XSLT to it ...
source to share