Importing from Adobe InDesign

Once you have it set up correctly, you can import all of the articles from an Adobe InDesign document, so conceivably this could mean all articles in a newspaper or magazine issue. This is a tremendous timesaver compared to inputting each article by cut-and-paste, so it’s worth the few steps required to set it up.

The method makes use of the new Import Legacy Archive feature in Campsite 3.2.1 and the XML features of Adobe InDesign version CS2 and later.

Adobe InDesign can export articles as XML, and it has a number of useful features for converting your existing styles to XML tags. The main methods to do so are described in InDesign‘s Help -> XML -> Exporting to XML section. This article on O’Reilly’s XML.com is also useful.

You will have to prepare your InDesign document so that it exports tags in a way that Campsite can understand what to do with the text, but those steps are relatively straightforward.

Matching up your InDesign styles with Campsite’s fields

You will need to prepare your InDesign document so that it can be used with Campsite, but once it’s done, you can either save the document as a template or reuse the document with ‘Save As’ for every issue.

  • Open the Tags window in InDesign
  • Select ‘Load Tags’ from the window’s menu (the little triangle at the top)
  • Open the ‘Content.xml’ file that contains the tags Campsite expects at import. The Campsite tags will appear in the InDesign Tags menu.
  • While you can manually mark each piece of text with a tag, this is cumbersome. It’s much better to use the ‘Map Styles to Tags’ option in the Tags window.
  • The ‘Map Styles to Tags’ window will appear with the InDesign style in the left column and the Campsite tag in the right column. Click on the [Not Mapped] text and a pulldown menu will appear with the Campsite tags.
  • Select the Campsite tag that best corresponds with your InDesign tag.
  • You can see the tags and how they are structured by using the Structure menu in InDesign, which is in View -> Structure -> Show Structure. A sidebar will appear on the left side of the window showing each of the tags.
  • As it stands right now, InDesign uses the default tags of “Root” and “Story”. For our purposes these correspond to “articles” and “article” in content.xml.
  • Click on the word “Root” in the Structure menu. Then change it to “articles” in the Tags window.
  • You will probably have a lot of items in the Structure menu marked “Story.” You can change all these at once by closing all their triangles, shift-selecting the word “Story” and then clicking on the “article” tag in the Tags window.
  • You can see which tags are used in an article by clicking on the triangle. If all went well, the article will have sub-items like name, deck, author, etc.
  • WARNING: InDesign‘s “Map Styles to Tags” function creates multiple tags for each paragraph. When this happens, you have two options: 1) To edit the XML text by hand (using search/replace) and remove the redundant tags, or 2) using the Structure menu to merge the tags.

Using InDesign‘s Structure menu to clean up your redundant tags

If all has gone well with your tagging, you will have a root item called “articles” and several main items called “article” in the Structure menu. Then things will probably be messy, with multiple items marked “full_text” or “intro” or whatever. You can clean this up pretty quickly by doing the following:

  • Highlight all the extra item tags (like the ones that say “full text”) and drag them to the first tag of the same name. They will then appear as sub-items.
  • Click all the sub-items and select “Untag Element”

Exporting Your InDesign XML

The process of exporting your InDesign XML is pretty straightforward, but be warned: This version of Campsite is really finicky about having all of its tags just so. You may be repeating these steps several times before you get it entirely perfect.

To export the XML, go to InDesign‘s File -> Export menu. Give your XML export file a good name and select “XML” from the “Format” menu. Click save. You should then have an XML file that Campsite can live with.

Importing Your InDesign XML file Into Campsite

  • In Campsite 3.2.1’s admin interface, select Actions -> Import Legacy Archive.
  • Select your article type. Make sure your article type includes all the fields named in content.xml with the exact same names.
  • Select your publication and language (these are mandatory)
  • Select your issue and section (these are optional)
  • Click ‘Browse’ and add your XML export file.

If all goes correctly, your articles should import correctly and you will get a confirmation message saying that X articles successfully imported. The articles can be seen in the “Pending Articles” menu from the Admin Interface.

Error Messages

You may get two different error messages. One may say that the article did not import. If that happens, it’s still worth checking your Pending Articles menu to see if some of your articles did get through.

The other error message may say something like this:

The article type field "Byline" does not match any field from XML input file.
The article type field "Teaser_a" does not match any field from XML input file.

That will probably also be OK; that message comes up if a Campsite field is left blank.

TODO: In a future version, Campsite should automatically parse the text and remove redundant tags, such as instances where “</tagname><tagname>” occurs, where tagname is the same in two adjacent tags.

TODO: Create a content.xml file that includes all fields from all article types on the site.

Sample Files

Two sample files are attached here: A sample InDesign file with 5 articles, and its XML export file. In the InDesign file, pay special attention to the Tags menu, the “Map Styles to Tags” menu and the Structure window to see what correct structure should look like.

Attachments