Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Importing XML

From: InDesign CS4 Beyond the Basics

Video: Importing XML

We are starting off with our document in the same state as it was at the end of the last movie, so if you didn't watch that one first, you may want to go do that now. We have tagged each of the frames that we want to populate with XML content, so now it's time to import our XML file. To do that, I am going to choose the Root element, this top Root element in the Structure pane. Now, I will choose Import XML either from the File menu or the Structure pane flyout menu. I will choose one of these XML files, and then I want to make sure that Show XML Import Options is on. I always want to have that checkbox on.

Importing XML

We are starting off with our document in the same state as it was at the end of the last movie, so if you didn't watch that one first, you may want to go do that now. We have tagged each of the frames that we want to populate with XML content, so now it's time to import our XML file. To do that, I am going to choose the Root element, this top Root element in the Structure pane. Now, I will choose Import XML either from the File menu or the Structure pane flyout menu. I will choose one of these XML files, and then I want to make sure that Show XML Import Options is on. I always want to have that checkbox on.

Also, because I chose the Root element first, it gives me the option to Import Into that Selected Element; in this case I definitely want to do that. Then it lets me either Merge or Append the content. Merge means, well, it means basically the same thing as Import Into Selected Element. It means put all that incoming XML information into the elements in here, inside Root. That's what we want. Append Content means add that information after the XML information that's already here. That's not really going to do us any good in this case. We want to merge it into the selected element.

I will click Open and we get the XML Import Options dialog box. The first option here is Mode. We can choose Merge Content or Append Content, which is basically the same choice that we just made a moment ago. I really have no idea why they put that pop-up menu here. I guess maybe if you change your mind or something. Next, you have the option to create a link. This is very interesting, because it means that if your XML file changes, we can update it in InDesign automatically. I will show you that in a minute. I will go ahead and turn that one on.

XSLT is kind of a supercharged find/ change feature, which lets you change aspects of the XML file upon importing. You might use an XSLT in order to move things around. For example, if your XML file doesn't match the structure of your InDesign structure, you could use an XSLT to move it around, or you could add static elements that you want to put inside these frames that aren't actually in the XML file. There is a lot of ways that you can use XSLT files, but that's pretty advanced, and I am not going to get into it anymore right now.

Clone repeating text elements is the key to importing lots and lots and lots of XML data and make it repeat in your InDesign file. For example, you could import 10,000 different elements inside an InDesign file and have it automatically add it one after another. So that's what that's about. In this case it's not really relevant, so I am going to leave that turned off. Only import elements that match existing structure has to do with the structure of the XML file and the structure of the InDesign file. Your XML file may have a lot of elements that don't exist in the InDesign structure, and so you have a choice of whether to import those or just ignore them. In this case I am going to go ahead and import them by leaving this checkbox unchecked.

The next item here, Import text elements into tables if tags match, has to do with importing XML data obviously into a table. Well, we would need a table obviously and we would need to tag every cell inside that table and we need to make sure that the names of each of those cells match the names of the elements in the XML. I just have to tell you, it is fraught with peril. It is really complicated getting tabular data from an XML file into an InDesign table. It's possible, but I have just heard so many people have troubles with that.

Anyway, in this case it's completely irrelevant because I don't even have a table in this document. Now, whitespace elements. A lot of people insert whitespace elements, in other words, tabs or returns or extra spaces, or things, just to format the XML file and make it look pretty. Well, that is stuff we do not want to have in our InDesign document, we would like InDesign to strip all of that extra whitespace stuff out before it gets into the InDesign document. So I am going to go ahead and turn on Do not import the contents of whitespace-only elements, so I will leave that off.

The next option has to do with what do you want to have happen if some data doesn't come in. For example, let's say this image down here doesn't show up in the XML file, there is no second image, so what do you want to have happen, do you want that frame to still be there? Well, if I turn on this checkbox then InDesign will literally delete that whole object if the incoming XML doesn't have that element in it. So that could be really useful depending on your situation. The last item here, Import CALS tables as InDesign tables. All I can say about that is, if you don't know what a CALS table is then you don't need to know what a CALS table is. So I would just leave it on or off, it's not going to bother me any.

Let's go ahead and click OK and see what happens. There we go. All the data came in just the way we had hoped. We have the title and the bodytext, the images, the subhead, and so on and so on. By the way, these images look a little bit strange to me. That's because the tags are still showing for these outlines. It actually has a color that sits on top of the image. So we can get around that simply by going into Preview Mode. Let's see. We will go into Preview Mode there, and now we don't see any of that additional tag information. In fact, why don't I drop this tag into the docs so we don't have to see that panel either? That is looking really, really good.

If we zoom in here, we can actually see that even the character styles have been applied in the proper place. Okay. Remember that I linked this XML file to the file on disk. So if I look in my Links panel I can see, there it is, there is the XML file, it has a little green checkmark saying, that is okay, everything is good to go. But the cool thing is, we can now edit the XML file and have it update automatically in InDesign. So I have selected that in the Links panel and I am going to click on the Edit Original. It opens the XML file in my default XML Editor here.

Why don't I change the name of the Header? I will just call this Yummy Ganache instead. I am going to save it; I just did Cmd+S or Ctrl+S on Windows, and I will go back to InDesign and look what happens. In a second it just updates automatically, it's great. There is a live link between the XML file and InDesign. The reason it updated automatically of course is that I used the Edit Original button. If I had edited it elsewhere, not used the Edit Original, then I would have gotten a little status update here saying that it had been updated, and then all I would have to do is click on the Update button instead. But either way, it's great to have this live link.

So that's it. We now have a working template with tagged frames. Each time the data changes, we simply update the XML file and import it into the InDesign document, or just update that link if we used the Create Link feature. But what if you have been handed an InDesign document and you need to get the XML out of it, not in? Well, that process is similar but with some important differences. Let's take a look in the next movie.

Show transcript

This video is part of

Image for InDesign CS4 Beyond the Basics
InDesign CS4 Beyond the Basics

90 video lessons · 24558 viewers

David Blatner
Author

 
Expand all | Collapse all
  1. 2m 11s
    1. Welcome
      1m 3s
    2. Using the exercise files
      1m 8s
  2. 25m 16s
    1. Reviewing Control panel shortcuts
      8m 34s
    2. Managing panels
      6m 14s
    3. Letting InDesign do the math
      2m 52s
    4. Using Selection tool clicks
      1m 39s
    5. Using Quick Apply shortcuts
      3m 2s
    6. Setting up context shortcuts
      2m 55s
  3. 23m 51s
    1. Using column guides
      3m 42s
    2. Formatting and positioning guides
      5m 15s
    3. Setting first baseline options
      5m 30s
    4. Using the Document grid
      3m 13s
    5. Setting bleeds
      3m 3s
    6. Using slugs
      3m 8s
  4. 48m 2s
    1. Shuffling pages (or not)
      2m 47s
    2. Scaling objects to a specific size
      2m 32s
    3. Aligning objects to a page
      4m 41s
    4. Using advanced libraries
      4m 5s
    5. Using advanced anchored objects
      11m 21s
    6. Setting non-printing objects
      3m 10s
    7. Creating notes
      5m 23s
    8. Using Data Merge
      10m 41s
    9. Creating templates
      3m 22s
  5. 39m 32s
    1. Creating polygons and starbursts
      2m 35s
    2. Setting custom stroke styles
      5m 15s
    3. Using advanced effects
      8m 46s
    4. Making masks in InDesign
      4m 10s
    5. Integrating InDesign and Illustrator
      4m 59s
    6. Setting compound paths
      5m 4s
    7. Using advanced clipping paths
      6m 6s
    8. Using advanced image transparency
      2m 37s
  6. 55m 26s
    1. Using advanced text formatting
      5m 37s
    2. Using other languages
      4m 22s
    3. Setting advanced paragraph numbering
      3m 12s
    4. Using GREP to find/change
      6m 54s
    5. Managing glyphs
      5m 6s
    6. Finding and changing glyphs
      2m 39s
    7. Adding footnotes
      7m 57s
    8. Creating outlines
      3m 39s
    9. Setting conditional text
      9m 16s
    10. Creating cross-references
      6m 44s
  7. 33m 3s
    1. Advanced text importing
      7m 49s
    2. Using Apply Next Style
      5m 4s
    3. Advanced text styling
      6m 9s
    4. Setting load styles
      2m 58s
    5. Linking to text files on disk
      4m 1s
    6. Understanding GREP styles
      7m 2s
  8. 1h 4m
    1. Building a multi-document book
      4m 42s
    2. Setting page numbering across books
      7m 53s
    3. Setting chapter numbering
      6m 7s
    4. Using the Section Marker feature
      6m 53s
    5. Creating "Continued On..." numbers
      4m 44s
    6. Synchronizing documents in a book
      5m 41s
    7. Creating a table of contents
      11m 24s
    8. Indexing documents
      7m 24s
    9. Generating an index
      6m 47s
    10. Printing or exporting a book
      3m 10s
  9. 46m 4s
    1. Creating hyperlinks
      12m 53s
    2. Setting bookmarks
      6m 7s
    3. Creating buttons
      11m 16s
    4. Making movies
      8m 24s
    5. Creating sounds
      4m 51s
    6. Setting page transitions
      2m 33s
  10. 25m 59s
    1. Setting up swatch and style defaults
      3m 24s
    2. Using mixed ink colors
      6m 16s
    3. Working with duotones
      4m 23s
    4. Overprinting
      2m 10s
    5. Ink aliasing
      4m 50s
    6. Using the Kuler panel
      4m 56s
  11. 50m 27s
    1. Creating the transparency blend space
      4m 6s
    2. Understanding InDesign color settings
      9m 8s
    3. Assign Profile and Convert to Profile
      3m 26s
    4. Working with RGB images
      7m 54s
    5. Working with CMYK images
      6m 28s
    6. Soft-proofing
      5m 18s
    7. Managing color at print time
      7m 25s
    8. Managing color in a PDF export
      6m 42s
  12. 42m 1s
    1. Embedding preflight profiles
      5m 1s
    2. Using the Transparency Flattener preview
      3m 23s
    3. Reviewing Transparency Flattener settings
      6m 30s
    4. Setting print presets
      3m 35s
    5. Setting PDF presets
      3m 21s
    6. Exporting to XHTML
      7m 42s
    7. Exporting to SWF
      6m 45s
    8. Exporting to XFL
      5m 44s
  13. 25m 58s
    1. Understanding XML and InDesign
      6m 51s
    2. Structuring InDesign content
      4m 17s
    3. Importing XML
      6m 57s
    4. Exporting to XML
      7m 53s
  14. 34s
    1. Goodbye
      34s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed InDesign CS4 Beyond the Basics.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.