Menu

#88 Use a custom PI to associate RNG grammar

open
None
5
2016-06-03
2007-08-02
No

According to the help file, "As RELAX NG does not define an association mechanism, you can ... select a grammar using a file dialog." However, it's a bit of a hassle to have to do this every time. In the absence of a standard mechanism, have you considered using a custom Processing Instruction to associate the RNG file with the document? e.g.
<?xmlcopyeditor_rng_grammar file:///path/to/my_custom_grammar.rng?>
If present, the validate (F6) option should use that grammar instead of asking the user to select the same file again and again; if not, the PI could be automatically added after the RNG file has been selected the first time (or have a checkbox option on the select dialog to have it add the PI if you don't want to make this mandatory). Any other application will not recognise the PI so should ignore it.
XMLSpy uses a similar method to associate a sample XML document with XSLT files you are editing, so you can test changes to the transformation with a single keypress.

Discussion

  • gnschmidt

    gnschmidt - 2007-08-02
    • assigned_to: nobody --> gnschmidt
     
  • gnschmidt

    gnschmidt - 2007-08-02

    Logged In: YES
    user_id=1298822
    Originator: NO

    Yes, you're right. I will try to add an 'Associate RELAX NG grammar' function as you describe it.

    Thanks!
    Gerald

     
  • gnschmidt

    gnschmidt - 2007-08-02

    Logged In: YES
    user_id=1298822
    Originator: NO

    PS Before I forget, you can also achieve single-keypress RNG validation by dropping your grammar into the rng folder. Up to 9 RELAX NG grammars are automatically made accessible in this way.

     
  • Andy Stevens

    Andy Stevens - 2007-08-02

    Logged In: YES
    user_id=247081
    Originator: YES

    You mean the Ctrl-1 to Ctrl-9 shortcuts? There were already more than 9 RNG files in that directory after the initial installation - what determines which ones are assigned to the shortcuts? I don't see anything for it in the Options.

     
  • gnschmidt

    gnschmidt - 2007-08-02

    Logged In: YES
    user_id=1298822
    Originator: NO

    Apologies, I hadn't realised there were so many already (I started with just a few). My suggestion would be to move all rng files you're not going to need elsewhere (could delete them too).

    I could also permit more than 9 entries and use Shift+Ctrl+[0-9].

    That reminds me I've also been meaning to lift the need for an rng extension so rncs can be activated in this way too.

    Will need to wait until after the holiday though :(

    Best,
    Gerald

     
  • Lars Huttar

    Lars Huttar - 2016-06-03

    +1 for this feature.
    However, see related feature request 163.
    I would rather see a more standardized PI, like <?xml-model?>, than an editor-specific one like <?xmlcopyeditor_rng_grammar?>.

    Thanks for your work on this useful software.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.