Thanks for your very detailed and quick response, Dave. Some comments inline below.
> -----Original Message----- > From: Dave Kuhlman [mailto:dkuhl...@davekuhlman.org] > Sent: Thursday, April 27, 2017 14:25 > To: Fernandez, Matthew <matthew.fernan...@intel.com> > Cc: generateds-users <generateds-users@lists.sourceforge.net> > Subject: Re: [Generateds-users] RelaxNG support > > Matt, > > Good to hear from you. > > A few points: > > - generateDS.py generates Python classes, not Haskell data > structures. Would that be useful for your needs? Yes, I realized generateDS was Python-only, but I was exploring whether it could be extended with a Haskell backend. The program into which the generated code would eventually be integrated could be written in Python, but we're currently targeting Haskell for some of the properties of its type system. > - You are correct. generateDS.py does not understand and cannot > handle RelaxNG. > > - Have you looked at Trang? The description I read seems to say > that it can convert RelaxNG to Xml Schema. So, theoretically, you > could convert your RelaxNG specification to XML Schema, then feed > that to generateDS.py. Here is a short description of Trang: > > XML schema converter > Trang converts between different schema languages for XML. It supports > the > following languages: > * RELAX NG (XML syntax) > * RELAX NG compact syntax > * XML 1.0 DTDs > * W3C XML Schema > Homepage: https://github.com/relaxng/jing-trang > > - I'm not aware that XML Schema is superior to RelaxNG either, > although the RelaxNG compact syntax does seem very appealing. XML > Schema is way too complicated. > > If you try using Trang to convert RelaxNG to XML Schema (or if you already > have done this), could you please report back on it. I'd like to be able to > recommend it, *if* it works. It requires Java, but I'm not a Java person and > do not have Java installed on my machines. > > Ooops. Wait a minute (or two). I did not realize this, but my Raspberry Pi > machines (running Linux Debian Jesse, I believe) have Java and the JDK > loaded on them my default. I'll give Trang a try. > ... > > OK. I cloned trang from https://github.com/relaxng/jing-trang.git, > and, then built it with: > > $ git clone https://github.com/relaxng/jing-trang.git > $ cd jing-trang > # set JAVA_HOME to location of JDK > $ export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt > $ ./ant > > Then ran it with: > > $ cd jing-trang/build > $ java -jar trang.jar -I rng -O xsd test01.rng test01.xsd > > which produced test01.xsd. > > I was able to run the result (test01.xsd) through generateDS.py, which > produced a few warnings, but did produce Python bindings (a Python > module containing Python classes for the element types defined in > test01.rng (and test01.xsd). That's very valuable experience for me to hear; thanks for jumping through the hoops on my behalf ;) I was aware of Trang, but had been under the impression it was no longer maintained and bitrotted. So it seems like it should be possible to construct a process like RelaxNG -> Java -> XSD -> Python -> Haskell, but I do not look forward to debugging that pipeline. The RelaxNG spec we have is pretty small, so in preference I'd be inclined to just transliterate it into XSD. > As we say: for what it's worth. Maybe it's worth a note in the generateDS.py > documentation or a blog post. What do you think? Did you mean documentation/blog about generateDS's current functionality? Or about future RelaxNG possibilities? Honestly the existing documentation looks very comprehensive; you've done a great job there. It was my own fault for not reading it before diving in. I didn't mean to suggest with my mail that the documentation was incomplete. I was just curious whether RelaxNG support was on the roadmap, in order to assess whether this tool would fit our needs. > Hope this helps. Let me know if/when you have more questions. > > Dave > > > On Thu, Apr 27, 2017 at 04:22:11PM +0000, Fernandez, Matthew wrote: > > Hello generateDS folk, > > > > > > > > I am trying to generate Haskell data structures from a RelaxNG > > specification. A promising jumping off point looked like generateDS, and > > I > > foolishly passed our RelaxNG spec to it before taking the time to read > > the > > docs and realize it is expecting XSD input. IIUC generateDS has no > > support > > for RelaxNG. Are there any plans to extend it in this direction in > > future? > > I am not an XML guru, so perhaps XSD is inherently superior to RelaxNG in > > some way of which I am not aware. Any feedback or helpful pointers > would > > be appreciated. Thanks for your time. > > > > > > > > Matt > > > ---------------------------------------------------------------------- > > -------- Check out the vibrant tech community on one of the world's > > most engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > > generateds-users mailing list > > generateds-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/generateds-users > > > -- > > Dave Kuhlman > http://www.davekuhlman.org ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users