Tagging content and working with XML in Layout by Zaweba
Object > XML in Layout by Zaweba tags frames and text, maps styles to tags, exports structure with pictures and imports XML into tagged frames.

Some content doesn't start life as a document. Product data comes out of a database, a directory is kept as structured records, a set of reports shares the same parts every time. XML is the common way of moving that kind of content between systems, and Layout by Zaweba can work with it directly: tagging content in a layout, exporting it as XML and importing XML to fill a template.
The tools live under Object > XML, with an XML panel to manage them.
Tagging frames, paragraphs and text
Tags label content by what it is rather than how it looks. A frame can be tagged as a product, a paragraph as a description, a run of text as a price. Tags are shown in colours on the page, so you can see at a glance which parts of a layout have been tagged and with what.
The XML panel shows the structure tree, the nested arrangement of tagged elements. A catalogue entry might hold a name, a description, a price and a picture, all inside a product element. The tree makes that structure visible and editable.
Mapping styles to tags
Styles and tags often line up. Every paragraph in the "Product name" style is a product name; every paragraph in "Price" is a price. Mapping styles to tags applies the tags automatically, based on the styles already in use. On a document that is already well styled, that does most of the tagging work in one go.
Mapping also keeps tagging honest. When the styles are right, the tags are right, and the two can't drift apart because one is derived from the other.
Exporting structure
Exporting writes the document's tagged structure as an XML file. Pictures go into an images folder alongside it. The result can feed a website, a database or another publishing system with the same content that went into the print layout, with its structure intact.
That is valuable when one set of content has to appear in several places. Lay out the printed catalogue, export the XML, and the web team has every product name, description, price and picture without copying anything by hand.
Importing XML into a template
Import works the other way. Build a template with tagged frames, then import an XML file and the frames are filled in order with the matching content. A directory, a programme, a set of product sheets or a recurring report can be produced by setting up the template once and importing fresh data each time.
For local files, the import can check the XML against a DTD, which describes the structure the XML is supposed to have. Checking catches missing or misplaced elements before they end up as gaps or muddles on the page.
When XML is the right tool
XML suits jobs where structure matters more than one off design, and where content comes from or goes to another system. For a simple list from a spreadsheet, data merge is usually quicker. For long, deeply structured content that must travel between systems, XML is the better fit.
Mistakes people make with XML
Tagging by hand when styles could do it wastes time. Style the document first, then map styles to tags.
Inconsistent styles make mapping unreliable. A product name sometimes styled as body text won't be tagged.
Skipping the DTD check on imports lets broken data through. Check local files before importing.
Building a template whose tagged frames don't match the order of the XML gives jumbled results. Match the template to the data's structure.
XML ties Layout's styles to the wider world of structured content. The same discipline that makes XML work, clear styles used consistently, also gives a better table of contents, cleaner EPUB export and better tagged PDFs. Even if you never export XML, thinking about what each piece of content is, rather than only how it looks, makes a document easier to reuse.