-
Notifications
You must be signed in to change notification settings - Fork 25
Editing LEMS and NeuroML2 files with Emacs and nXML mode
nXML-mode is helpful when editing xml files, as it performs real-time validation, context-sensitive completion and various other clever tricks. It's the default mode for xml editing since emacs 23. Unfortunately, it's designed to work with RELAX NG, while the NeuroML2 schema is expressed as a W3C XML Schema, so out of the box we will only get basic xml editing facilities. To work around this issue, an unofficial port of the NeuroML and LEMS schemas to rng and rnc formats is provided at https://github.com/epiasini/LEMS_NeuroML_RelaxNG.
Once you have downloaded the rnc files, you can instruct Emacs to use for instance LEMS_v0.7.rnc to validate a lems file by visiting that file and selecting the schema with C-c C-s C-f
. It might be useful to add
(global-set-key [C-return] 'completion-at-point)
(add-to-list 'rng-schema-locating-files "~/.emacs.d/schemas.xml")
to your .emacs
file to enable autocompletion with C-return
(rather than the somewhat inconvenient default M-C-i
) and to store all schema associations in a central file under your .emacs.d
directory.
- http://infohost.nmt.edu/tcc/help/pubs/nxml/index.html
- https://fedoraproject.org/wiki/How_to_use_Emacs_for_XML_editing
- http://stackoverflow.com/questions/917337/schema-sensitive-editing-in-emacs-based-on-w3c-xml-schema-not-rng
- http://relaxng.org/#conversion
- http://www.shadegrowncode.com/2009/08/converting-xml-schema-to-relax-ng.html