Skip to main content

Connexions CNXML Library

Project description

CNXML Library

This is a python library for working with CNXML content, which includes the CNXML and COLLXML formats.


This library requires Python >=3.5.

Install using:

pip install -e "."


Use the tox to run the tests:


If tox is not installed, run the following:

pip install tox

Edit/Validate files using


  1. Install
  2. Get the cnxml RNG Schema files
    1. Download the most recent version from (click the “zip” link)
      • It should be in your Download foler
      • Move it to ~/.neb/
    2. Unzip the file
    3. It should have created a folder named something like cnxml-2.0.0 (with /cnxml/xml/cnxml/schema/rng/0.7/cnxml-jing.rng in it)
    4. Rename the folder to be something you are unlikely to accidentally delete (like cnxml-validation)
      • Remember the name for later when you are editing ~/.atom/config.cson


  1. Start up Atom
  2. Install the linter-autocomplete-jing package
  3. Type <kbd>⌘</kbd>+<kbd>,</kbd> (for Mac) to open Settings (or click Atom, Preferences… in the menu bar)
    1. Click Install in the left-hand-side
    2. Enter linter-autocomplete-jing and click Install
    3. Alternative: run apm install linter-autocomplete-jing from the commandline
  4. Edit ~/.atom/config.cson by clicking Atom, Config in the menu bar and add the following lines (at the bottom of this document)
  5. Restart Atom
  6. Open an unzipped complete-zip. (I run atom ~/Downloads/col1234_complete From a terminal)
  7. Verify by opening an index.cnxml file and typing in <figure> somewhere in the file. If it is a valid location then it should auto-add id=”” for you

Changes to ~/.atom/config.cson:


      # Add this to the bottom of the customFileTypes area.
      # Note: Indentation is important!
      "text.xml": [

  # And then this to the bottom of the file
  # 1. Make sure "linter-autocomplete-jing" only occurs once in this file!
  # 1. make sure it is indented by 2 spaces just like it is in this example.

    displaySchemaWarnings: true
    rules: [
        priority: 1
          pathRegex: ".cnxml$"
          schemaProps: [
              lang: "rng"
              path: "~/.neb/cnxml-validation/cnxml/xml/cnxml/schema/rng/0.7/cnxml-jing.rng"


This software is subject to the provisions of the GNU Affero General Public License Version 3.0 (AGPL). See license.txt for details. Copyright (c) 2016 Rice University

Change Log


  • Update schema and add support for slug in metadata (#30)


  • Add support for new optional metadata (#28)


  • Relax required information when parsing metadata (#25)


  • Re-release of 3.0.0


  • Add tests for cnxml <md:derived-from …> validation
  • Fix failing derived-from cnxml validation tests
  • Use a self-closing md:derived-from as the valid repr
  • Move the metadata parsing from Press to cnxml (#20)
  • Add a CLI utility for extracting cnxml metadata to json (#22)


  • Extend validation API to accept multiple documents to validate


  • Tweak mdml schema to properly allow any metadata element under derived-from


  • Remove external pathlib dependency
  • Drop support for Python <= 2.7
  • Use versioneer for project versioning
  • Correct license in
  • Add instructions to validate with the editor


  • Add a commandline interface for collxml validation
  • Rename main cli function to make room for another entrypoint
  • Make the metadata section required in collxml
  • Add collxml validation function


  • Use a namedtuple for validation error line data.


  • Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cnxml, version 3.1.2
Filename, size File type Python version Upload date Hashes
Filename, size cnxml-3.1.2-py3-none-any.whl (914.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page