The structured-content layer
The element vocabulary of IDML's tagged-XML layer — XMLTag in Tags.xml, the XmlStory and its XMLElement tree in BackingStory.xml, and the rarer nodes and maps.
The tagged-XML layer is a short vocabulary: XMLTag names a tag, XMLElement applies it, and an XmlStory holds the tree.
In short XML/Tags.xml lists the document's tags, one XMLTag each, with a
Name and a typed TagColor property. XML/BackingStory.xml holds one XmlStory,
which is shaped like an ordinary story: paragraph and character ranges with
XMLElement nodes among the Content. Each XMLElement names its tag in MarkupTag.
Nodes for XML attributes, comments and processing instructions, and the tag-to-style
maps, exist in the vocabulary but are rare: none of the 305 documents in the census
uses them.
XMLTag: the tag names (Tags.xml)
XML/Tags.xml has an idPkg:Tags root with one XMLTag per tag the document defines.
A tag is a name and a colour; it holds no content. Other parts refer to it by Self,
which InDesign writes as XMLTag/<name>. The colour shown beside the tag in InDesign is
a typed property, <Properties><TagColor type="enumeration">LightBlue</TagColor></Properties>.
Every InDesign document defines at least the tag Root.
| Attribute · XMLTag | Values | Paged | paged.set |
|---|---|---|---|
| Name | enum | not read | |
| Self | XMLTag reference | not read | |
| TagColor in Properties | — | not read |
XmlStory: the backing story (BackingStory.xml)
XML/BackingStory.xml has an idPkg:BackingStory root holding a single XmlStory.
Note the spelling: XmlStory, not XMLStory. It is built like a layout story, with the
same story attributes (AppliedTOCStyle, TrackChanges, StoryTitle, UserText) and
the same body of ParagraphStyleRange and CharacterStyleRange elements. It anchors
the root of the XML tree and holds content that has been tagged but not placed on a
page.
In an untagged InDesign document the backing story is one paragraph whose character
range holds a few zero-width U+FEFF characters around the root element:
<XMLElement Self="di3" MarkupTag="XMLTag/Root"/>.
XMLElement: the tree
An XMLElement applies a tag. MarkupTag names the XMLTag, and Self is its id.
Nesting one XMLElement inside another builds the hierarchy. An element can sit in a
character range among the text it tags, or carry an XMLContent attribute naming the
Self of placed content, such as a story or a frame, that it labels.
| Attribute · XMLElement | Values | Paged | paged.set |
|---|---|---|---|
| MarkupTag | XMLTag reference | not read | |
| Self | text | not read |
In the census, 271 documents carry an XMLElement, almost always the single root
element; two nest elements inside it, and XMLContent does not occur at all.
The rarer nodes
The vocabulary has a few more node types for a tagged tree. None of them appears in the census, so their attributes are listed by name only:
| Element | Records | Attributes |
|---|---|---|
XMLAttribute | an XML attribute on a tagged element | Self, Name, Value |
XMLComment | an XML comment in the tree | Self, Value, StoryOffset |
XMLInstruction | an XML processing instruction in the tree | Self, Target, Data, StoryOffset |
The maps (Mapping.xml)
XML/Mapping.xml holds the mappings between tags and styles in both directions:
XMLExportMap maps a style to a tag, and XMLImportMap a tag to a style, each naming
an XMLTag in MarkupTag and a paragraph or character style in MappedStyle. InDesign
did not write this part in any of the census documents, and the design map has no
reference to it; it appears only in generated files, as an empty idPkg:Mapping root.
In Paged: none of these elements is read; the layout is the same with or without them. The XML parts are copied byte for byte when a document is saved. See reading and preserving tagged XML.
Planned
Frequently asked questions
What is the difference between an XMLTag and an XMLElement?
An XMLTag in Tags.xml is a name in the document's tag list. An XMLElement in the
backing story applies that tag to content, naming it in MarkupTag. Many elements can
use one tag.
Is it XmlStory or XMLStory?
XmlStory, with only the X capitalised, unlike XMLTag and XMLElement.
What does an untagged document's backing story contain?
One paragraph with a single XMLElement applying the Root tag, surrounded by a few
zero-width U+FEFF characters.
Does InDesign write XML/Mapping.xml?
Not in any of the InDesign-exported documents in the census. The design map does not
reference it.
Tagged XML inside IDML
IDML's second view of a document — an XML structure an author tags over the same text and frames as the layout, stored in XML/Tags.xml and XML/BackingStory.xml.
Reading and preserving tagged XML
What an application needs to read IDML's tagged-XML layer, and what it must keep intact when it edits and saves a document without reading it.