XML basics
The two kinds of XML you can import, how to import them, the common rules and samples.
What you can import
You can import two kinds of XML that you write yourself into MyCodex.
- Rules: company regulations, club rules and the like, written in the same format as Japanese laws (Japanese Standard Law XML, also known as the e-LAWS format). They are typeset the same way as laws from e-Gov. See Writing rules.
- Dictionaries: glossaries, books of quotations, timelines and the like, written in the MyCodex dictionary XML. Each dictionary decides how its entries are sorted and grouped. See Writing dictionaries.
You do not have to write the XML by hand. MyCodex Editor lets you fill in forms and export the file. It runs in your browser and keeps what you write only in that browser.
Importing
Import a file in either of these ways.
- In the MyCodex library, tap "+" at the top right, choose "Import XML Files" and pick the files. You can pick more than one.
- Open an
.xmlfile from the Files app or AirDrop and share it to MyCodex.
MyCodex tells rules and dictionaries apart by their content. If the outermost element is <Dictionary>, the file is read as a dictionary; otherwise it is read as rules.
If your library already has rules with the same title, you can choose "Overwrite", "Add as a Revision" or "Add as Separate Rules". Adding a revision groups the file with the existing rules as a new version, and you can switch between versions while reading. When you import several files at once, MyCodex does not ask and adds each one as separate rules.
Importing the same dictionary again adds it as another dictionary. After importing a corrected dictionary, delete the old one from your library.
Common rules
These rules apply to both rules and dictionaries.
- Save the file as UTF-8 with the
.xmlextension. - To write
&,<or>in text, write&,<or>. - Write element names with the exact upper and lower case. If you write
<entry>instead of<Entry>, the element is not read.
When a file cannot be imported
After importing, MyCodex lists the files it could not import and why. A file is rejected only in the cases below. Any other mistake is read with a default value.
Rules:
- The XML is broken (for example, a tag is not closed). The line and column are shown.
- There is no
<Law>element. - There is no title (
<LawTitle>).
Dictionaries:
- The XML is broken.
- There is no
<Dictionary>element. - There are no entries (
<Entry>). - The format version (
version) is not an integer, or is newer than your MyCodex can read. Update MyCodex to import a dictionary in a newer version. - Two entries have the same
id.
Samples
Use these samples as a starting point. You can also import them as they are to see how they look.
Club rules (rules)Rules with chapters, articles, paragraphs, items, a proviso and supplementary provisions.
Legal glossary (dictionary)A word dictionary with types, tags, importance, links and ruby.
Book of quotations (dictionary)The text takes center stage, grouped by speaker.
Timeline (dictionary)Sorted by the numeric year.