diff --git a/doc/xml-format.md b/doc/xml-format.md new file mode 100644 index 000000000000..2a9e379cccd9 --- /dev/null +++ b/doc/xml-format.md @@ -0,0 +1,147 @@ +This doc is a rough spec of our xml format + +Every content element (within a course) should have a unique id. This id is formed as {category}/{url_name}. Categories are the different tag types ('chapter', 'problem', 'html', 'sequential', etc). Url_name is a string containing a-z, A-Z, dot (.) and _. This is what appears in urls that point to this object. + +File layout: + +- Xml files have content +- "policy", which is also called metadata in various places, should live in a policy file. + +- each module (except customtag and course, which are special, see below) should live in a file, located at {category}/{url_name].xml +To include this module in another one (e.g. to put a problem in a vertical), put in a "pointer tag": <{category} url_name="{url_name}"/>. When we read that, we'll load the actual contents. + +Customtag is already a pointer, you can just use it in place: + +Course tags: + - the top level course pointer tag lives in course.xml + - have 2 extra required attributes: "org" and "course" -- organization name, and course name. Note that the course name is referring to the platonic ideal of this course, not to any particular run of this course. The url_name should be particular run of this course. E.g. + +If course.xml contains: + + +we would load the actual course definition from course/2012.xml + +To support multiple different runs of the course, you could have a different course.xml, containing + + + +which would load the Harvard-internal version from course/2012H.xml + +If there is only one run of the course for now, just have a single course.xml with the right url_name. + +If there is more than one run of the course, the different course root pointer files should live in +roots/url_name.xml, and course.xml should be a symbolic link to the one you want to run in your dev instance. + +If you want to run both versions, you need to checkout the repo twice, and have course.xml point to different root/{url_name}.xml files. + +Policies: + - the policy for a course url_name lives in policies/{url_name}.json + +The format is called "json", and is best shown by example (though also feel free to google :) + +the file is a dictionary (mapping from keys to values, syntax "{ key : value, key2 : value2, etc}" + +Keys are in the form "{category}/{url_name}", which should uniquely id a content element. +Values are dictionaries of the form {"metadata-key" : "metadata-value"}. + +metadata can also live in the xml files, but anything defined in the policy file overrides anything in the xml. This is primarily for backwards compatibility, and you should probably not use both. If you do leave some metadata tags in the xml, please be consistent (e.g. if display_names stay in xml, they should all stay in xml). + - note, some xml attributes are not metadata. e.g. in