10 Replies Latest reply on Nov 4, 2011 10:15 AM by John Hawkinson

    Exporting XML. Why is only the "root" there?

    Peter B. Bailey Level 1

      I've got a 332 page book, all legalese, with lots of footnotes. When I export it to XML, all I get is a root element. What am I missing?

       

      Thanks,

      Peter

        • 1. Re: Exporting XML. Why is only the "root" there?
          Jeffrey_Smith Most Valuable Participant

          An Indesign document and it's content must be tagged first before exporting XML, is your document tagged?

          • 2. Re: Exporting XML. Why is only the "root" there?
            Peter B. Bailey Level 1

            Uh, no. What does a "tagged" document look like? This is seeming quite complicated now. Thanks for your response.

            • 3. Re: Exporting XML. Why is only the "root" there?
              John Hawkinson Level 5

              It is complicated! XML workflows are not simple.

              InDesign's XML import is a method for you to sculpt your document into a very specific sort of XML that reflects some attributes of your document that you choose. It is not a generic representation of the whole document.

               

              IDML export, on the other hand, is an XML-based file format that contains your whole document. That might be what you're looking for.

               

              But please give us a lot more detail! XML is complicated and pretty much always horribly painful.

              What is it you want to do with the XML export? What tools will you feed it to? What will it get used for?

               

              This all matters, unfortunately.

              • 4. Re: Exporting XML. Why is only the "root" there?
                Peter B. Bailey Level 1

                I work for a publishing company. We're pretty SGML/XML saavy. I'm not directly involved with it. I'm in production. But, one of our data analysts wanted to see xml exported from inDesign. We have a number of books that were done in ID and we're looking into ways of capturing the data for re-use. How easy, or how hard, it would be to pipe the XML into our SGML for publication. And so on.

                 

                I'm looking through this book, though, on the Safari website. I guess Safari took over Peachpit. I went to the Peachpit web site and it sent me to Safari. Anyway, there appears to be a pretty thorough book there called "A Designer's Guide to Adobe InDesign and XML." Juicy stuff.

                 

                I did send this guy, though, an IDML file. I'll see if it works for him. I imagine it might be too full of typographic attributes, but, I'l let him tell me.

                 

                Thanks,

                Peter

                • 5. Re: Exporting XML. Why is only the "root" there?
                  Jeffrey_Smith Most Valuable Participant

                  XML workflow, either importing or exporting can seem complicated. But here is a primer...

                  xml.jpg

                  Structure View (left side): View > Structure > View Structure

                   

                  Tag Panel: Open this panel, create new tags

                   

                  Frames can be tagged as well as the content (text or graphic) within frame

                   

                  Paragraph styles can be mapped to Tags.

                   

                  What I did for this example:
                  I created 1 text frame, entered text, created 2 paragraph styles, applied the styles to text

                  Then I created 3 tags FRAME, BODY, SUBHEAD

                  Then I mapped styles to tags to create the XML structure

                  I can export XML and have some basic structure to be repurposed

                  • 6. Re: Exporting XML. Why is only the "root" there?
                    Peter B. Bailey Level 1

                    Thanks, Jefffrey. OK. I've got the structure view open. The only thing I can add in there, though, are "elements" and "attributes." I don't see tags. And, when you say tags, I assume you mean XML tags Are they the same as elements? If I choose "map styles to tags," then, wouldn't it set up a mapping between the ID style tags with XML elements? When I choose "map styles to tags," the right side of the equation just says "not mapped." And, when I click there, the only element there is root and it doesn't let me add anything else.

                    • 7. Re: Exporting XML. Why is only the "root" there?
                      John Hawkinson Level 5

                      I work for a publishing company. We're pretty SGML/XML saavy.

                      ...

                      I did send this guy, though, an IDML file. I'll see if it works for him. I imagine it might be too full of typographic attributes, but, I'l let him tell me.

                      Generally, (especially if you're XML-saavy), moving XML between applications involves using XML transformations to convert from one flavor of XML to another. So that's kind of nroaml. Hopefully you can just ignore the attributes that are unimportant to you.

                      Thanks, Jefffrey. OK. I've got the structure view open. The only thing I can add in there, though, are "elements" and "attributes." I don't see tags. And, when you say tags, I assume you mean XML tags Are they the same as elements? If I choose "map styles to tags," then, wouldn't it set up a mapping between the ID style tags with XML elements? When I choose "map styles to tags," the right side of the equation just says "not mapped." And, when I click there, the only element there is root and it doesn't let me add anything else.

                      Tags are not the same as element, they are declared in the Tags panel which is not part of the structure pane. And remember a tag is something like <EMPH>this</EMPH>, where "EMPH" is the name of the tag.

                       

                      You might find it instructive to drag a page item into the Structure pane.

                      • 8. Re: Exporting XML. Why is only the "root" there?
                        Peter B. Bailey Level 1

                        OK. Thanks. I've got the tags window open now and I see what it's for. I've got a chapter of a large legal book open, too. And, I've got structure open. In the tag window, I've chosen "map styles to tags." Nothing happens. When I click on a style in the tags window and choose a tag at the right, the only thing displaying is "root." It doesn't let me choose a tag. There are many, many style elemeents in this file. Do I literally have to add the tags manually? What's the purpose, then, of "map styles to tags?" And, why won't it let me do that?

                        • 9. Re: Exporting XML. Why is only the "root" there?
                          Jeffrey_Smith Most Valuable Participant

                          Peter, in the Tags Panel, you need to create a tag first. If you look at the screen capture I posted earlier in thread, you can see my Tags Panel. I create the tags by going to the flyout and selecting New Tag... I named them BODY and SUBHEAD. At this point, no content (text or frame) is actually applied the tag, you either have to do this manually by selecting content and then select the Tag. Or, in the event that you have a well styled document, you can do this automatically.

                           

                          From the sample document I used, I have paragraph styles that coincidentally have the same names as the tag (body=para style) (BODY=tag) Note, these names don't have to be the same. Now, I can map a paragraph style to an existing tag. Once this is done, then you will see the XML structure pane populate with data.

                          • 10. Re: Exporting XML. Why is only the "root" there?
                            John Hawkinson Level 5

                            It doesn't let me choose a tag. There are many, many style elemeents in this file. Do I literally have to add the tags manually?

                            Well, it's never necessary to do anything in InDesign manually. Try this quick little script:

                             

                            var i,d=app.activeDocument;
                            for (i=0; i< d.allParagraphStyles.length; i++) {
                              try { d.xmlTags.add(d.allParagraphStyles[i].name); } catch (e) { }
                            }
                            

                            Note that not all styles names are valid tag names (like [Basic Paragraph]), so the script just ignores errors creating styles.

                             

                            What's the purpose, then, of "map styles to tags?" And, why won't it let me do that?

                            As you've no doubt garnered, it is to avoid manually associating the styles with the tags once the tags are created.

                             

                            I believe I did mention that XML is no fun! Did you not believe me?