XMLSchema (.xsd) to Protocol Buffer(.proto) Converter

6,912 views
Skip to first unread message

Jana

unread,
Aug 15, 2008, 1:27:07 PM8/15/08
to Protocol Buffers
Hi Kenton,

I am using the Protocol Buffers and did some preliminary benchmark
testing between XML and PB. I am impressed with PB's results.

I am wondering is there any tool available to convert the XMLSchema
(.xsd) to PB (.proto) format since we do have a lot of xml schema
files to convert.

Please let me know.

Thanks,
Jana

Kenton Varda

unread,
Aug 15, 2008, 1:48:53 PM8/15/08
to Jana, Protocol Buffers
On Fri, Aug 15, 2008 at 10:27 AM, Jana <aji...@gmail.com> wrote:
I am wondering is there any tool available to convert the XMLSchema
(.xsd) to PB (.proto) format since we do have a lot of xml schema
files to convert.

Sorry, I don't know of any such tools, other than a one-off thing I wrote to help myself convert Doxygen's XML output to protobufs.  I've attached that code to this e-mail.  It is completely undocumented and it has parts that are specific to the Doxygen format that I was working with, so it probably won't help much except to give a vague idea of how this would be done.

The .xsl file contains XSLT code to convert an .xsd to a .proto file.  The .cc file is a corresponding program which converts an individual XML document to a protocol message, given the .proto file produced by converting the XSD.
xsd2proto.xsl
xml2proto.cc

Jana

unread,
Aug 15, 2008, 1:57:44 PM8/15/08
to Protocol Buffers
Thank You!
>  xsd2proto.xsl
> 7KViewDownload
>
>  xml2proto.cc
> 21KViewDownload

Jerry Walker

unread,
Apr 10, 2015, 1:45:47 PM4/10/15
to prot...@googlegroups.com
Did this work for you? I'm also in search of an XSD to PB converter. I tried to get the xsd2thrift project to build but was unsuccessful.

Is there a solid solution to this?

Thanks for your help.

Claudiu C

unread,
Dec 17, 2017, 12:20:21 PM12/17/17
to Protocol Buffers
Hello!

I want to generate protobuf representation from fpml XSD (http://www.fpml.org/the_standard/current/).  The target stack is c++. I've tried xsd2proto.xslt, but it doesn't work:\

xsltproc xsd2proto.xslt ../../Downloads/confirmation/fpml-main-5-9.xsd
runtime error: file xsd2proto.xslt line 52 element choose

Before I try to write protobuf utils myself for this (schema converter / marshaller), I wanted to ask if anyone tried this already or at least if I have a starting point.

Many thanks,

Claudiu


dolg...@gmail.com

unread,
Dec 26, 2017, 12:28:29 PM12/26/17
to Protocol Buffers
Stuck with the same error
I found out that "call-template" requires declaring all incoming parameters.
So just add <xsl:param name = "type" /> into all callable templates. In particular, insert "<xsl:param name = "type" />" at line 52 after "<xsl:template name="typename">"
Reply all
Reply to author
Forward
0 new messages