#4 RelaxNGParse?

dtdparse (5)
Matej Cepl

Would it be possible to produce a script producing
similar output as dtdparse, but for Relax NG? There
are editors (namely kate/kwrite) which use output of
dtdparse for XML editing. However, world seems to be
turning from DTDs, so it would be helpful if I can
produce the same output for other definition files.
And both Schema and DTD could be translated into
Relax NG
so that seems to be the most supported solution.



  • Earl Hood
    Earl Hood

    Logged In: YES

    Are you asking for a script that parses RelaxNG data
    and creates a "dtd" document that dtdparse does for
    SGML/XML DTDs? Or, are you asking that dtdparse has
    the ability to generate RelaxNG from a DTD?

    If the former, the script would be a different beast
    from dtdparse, maybe something called rngparse, and it
    may be considered something completely separate from
    this project.

    If the latter, the XML document created be dtdparse
    can be parsed by a script that knows how to convert
    the data to relaxng. It appears the Sun link you
    provides already performs a similar function so what
    is the real need to add it here?

  • Matej Cepl
    Matej Cepl

    Logged In: YES

    The former -- just hoped that you could use some Relax NG
    parser in Perl (is there something like that) so that it
    wouldn't be that much difficult. I know, it was probably
    stupid idea.


  • Earl Hood
    Earl Hood

    Logged In: YES

    Generating RelaxNG from a DTD should not be too difficult.
    The approach would be to write a script that takes the
    the XML output of dtdparse and translates into RelaxNG
    syntax. Technically, no RelaxNG parsing is needed since
    it is only a final output form.

    The script can be written in Perl or it could, in theory,
    be writting in XSLT.

    I've considered moving some of the function in the
    dtddiff script into a module so other scripts can access
    them. Functions exist to parse dtdparse XML output along
    with some utility functions.

    In sum, in DTD-to-whatever-format can use the XML output
    of dtdparse as the basis of the conversion.