Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In order for you to import XML into an InDesign document, you need to give it structure and that structure is all based on tagging your objects. There are a number of ways to tag objects in InDesign, but one of the simplest is to use the Tags panel, which you can find under the Window menu. We need to add a tag here for each element in the XML file. Let's switch over to the XML file and look what we have got. We can see that the first top level element is called Root, then we have got Header, then we have got Story, Body Text and so on. So we better start here, Root is already there for us. That's the default top level in all XML files in all new documents of InDesign.
Now, let's add a new tag by clicking on this New Tag button and I am going to call this Header. Make sure it's named exactly the same as it is in the XML file. You can tell that it will be pretty boring having to add these tags one at a time. So instead, I am going to go to the Tag panel flyout menu and choose Load Tags and I am just going to select that XML file. You can load tags from either an XML file or another InDesign file that already has tags. I will click Open and all the tags from that InDesign file show up in the Tags panel. Now, it's time to assign these tags to objects in my InDesign file. The fastest way to do that is simply to select an object on the InDesign page and then click on the tag. This one is going to be the header, this one is going to be the story. This is going to be Image1, here is image2 and then finally this one here is the caption.
If I later go and select one of these, you can see that the tag is selected in the Tags panel as well. However, that's kind of a tiresome and annoying way to figure out which tag is associated with which object. So I am going to go to the View menu, scroll down to Structure and choose Show Tagged Frames. This way, each object is color coded with the tag that's associated with it. That's a lot easier to read. Now, there is another way to see the structure in our document as well, and that's to go to the View menu, choose Structure and then choose Show Structure or press Command+Option+1 or Ctrl+Alt+1 on Windows.
This opens the Structure pane along the left side of the Document window, and we can resize this to the left or the right if we need to. If I click on this little triangular twirly thing, we can see all of the elements inside the Root element. We are going to start with Header, Story, Image1, Image2 and Caption. If I just import the XML file, it may come in completely unformatted because InDesign has no idea how to map the XML tag to the paragraph and character styles in my document. So I need to tell it that information.
I will go to the Tags panel fly-out menu, and choose Map Tags to Styles. Header is an easy one because it's going to map directly to a paragraph style called header. Body Text should map to the Body paragraph style, Caption should map to subhead text. You can just go through here one at a time. Emphasis is going to go to a character style called Italic, Image1 is not mapped, Image2 is not mapped and Story is not mapped because that actually holds the body text. If you can, it's a better idea to have the same names as tags and paragraph styles. That way you can just click the Map by Name button and all of that would be done automatically. I will go ahead and click OK, and I need to do one more thing to this document, to the Structure pane over here. Let me switch back to the XML file for a moment, and if I read through this, which I admit is a little bit annoying and frustrating. But I can see that we have got the header and then the body which is inside story and then I have an image followed by the caption, followed by the last image.
So when I come back here, I need to move my caption up in between these two images. I am going to do that simply by clicking and dragging it up. When I see the dark line, I let go. Now, the structure here is going to match to the structure in the XML file. Our template is now complete. Notice that there is no text or graphics in this file because the important thing is the tags, not the content inside the frames. In the next movie, we will look at the details of importing our XML into our template.
Get unlimited access to all courses for just $25/month.Become a member
117 Video lessons · 42901 Viewers
119 Video lessons · 54237 Viewers
65 Video lessons · 14496 Viewers
113 Video lessons · 82888 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.