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?

- 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).

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?

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

Reply via email to