11 Replies Latest reply on Sep 18, 2014 8:27 AM by aclaborn@spe.org

    XML import to InDesign Table

    aclaborn@spe.org

      I am trying to create a template file in InDesign for an event program that is formatted in tables in InDesign.  The XML data is not in a table structure.  Is there anyway that I can import the XML data into a table in InDesign?

       

      In the Program data there are numerous sessions per day; so I would ideally like to create a table for the 1st session and then import the xml and have the data flow in that same format for the remaining sessions/days in the program since each session has the same tags.  So one table would be one session. 

       

      Is this possible?

       

      Thanks - Ashley

        • 1. Re: XML import to InDesign Table
          MW Design Level 4

          Ashley,

           

          What does your XML look like?

          Do you need separate tables for each day "automatically"? Or, can you opt to split the tables manually?

           

          An XML file can be manipulated via an XSL/XSLT, best done in an XML editor. So it is relatively easy to take well-formed XML and make it a CALS table. Which means no formatting. Once manually split, one can then easily apply a table style as you go.

           

          Making the XML have one table for day's sessions, like it sounds you want, is also doable, but generally an XSLT has to be made for that one XML format (it would break if the XML in the future changed). Which is why it would be good to see a day or two worth of sessions <--and that assumes it exactly represents the entirety of the XML structure.

           

          Take care, Mike

          • 2. Re: XML import to InDesign Table
            aclaborn@spe.org Level 1

            Thanks Mike; I was afraid that was the answer.  Below is an example of my XML.  The thing to keep in mind is that this is a template to be used across all of our events; so the data within the XML will change; however the structure and tags of the XML will remain the same for each meeting.  The individuals using the template will not know how to modify the XML; all they will be able to do is simply import a new XML file into the InDesign Template.  The format of the InDesign Template needs to clearly display this information; ideally in a table format for the event program.  If you have any ideas on how I might accomplish this without modifying the XML please let me know; I am open to other options.

             

            Thanks Ashley

             

            - <Sessions>

             

            - <Session>

             

            <SessionID_s>01</SessionID_s>

             

            <SessionBegins_sdt>2015-02-23T08:30:00</SessionBegins_sdt>

             

            <SessionEnds_sdt>2015-02-23T12:00:00</SessionEnds_sdt>

             

            <SessionTimeSpan_sh>0830-1200</SessionTimeSpan_sh>

             

            <SessionTitle_sh>Complex Recovery Processes</SessionTitle_sh>

             

            <SessionDescription_sh>Increasing energy demand has led to consideration of increasing complex recovery processes. Reservoir simulation compliments laboratory and field testing by enabling detailed investigation of proposed mechanisms and predictions at a variety of scales. Topics in this session include thermal recovery, geochemical reactions, remediation, and a variety of displacements for enhanced oil recovery.</SessionDescription_sh>

             

            <Location_s>Legends I-III Ballroom</Location_s>

             

            <HumanID_s>Session #01 (on Mon 23 Feb from 08:30 to 12:00 @ Legends I-III Ballroom)</HumanID_s>

             

            <Key_s>0</Key_s>

             

            <SessionTypeName_s>Technical</SessionTypeName_s>

             

            <SessionClasses_s>technical_session</SessionClasses_s>

             

            <MultiChairBlock_sh><span class="person"><span class="person_name">Jan Dirk Jansen</span>, <span class="org_name">Delft University of Technology</span></span>; <span class="person"><span class="person_name">Kristian Jessen</span>, <span class="org_name">University of Southern California</span></span></MultiChairBlock_sh>

             

            - <Controls>

             

            - <Control>

             

            <ControlID_i>112</ControlID_i>

             

            <ControlBegins_sdt>2015-02-23T08:30:00</ControlBegins_sdt>

             

            <ControlEnds_sdt>2015-02-23T09:00:00</ControlEnds_sdt>

             

            <ControlSpans_s>0830-0900</ControlSpans_s>

             

            <PosterBoardNumber>173194</PosterBoardNumber>

             

            <PublishingTitle>Modeling and Optimization of Low Salinity Waterflood</PublishingTitle>

             

            <AuthorBlock>L.X. Nghiem, Computer Modelling Group Ltd.; C.T. Dang, N.T. Nguyen, Z. Chen, University of Calgary; Q.P. Nguyen, University of Texas At Austin</AuthorBlock>

             

            <ProgramStatusName>Accepted</ProgramStatusName>

             

            <SessionRoleStatus>Primary</SessionRoleStatus>

             

            <ActivityName>Proposal</ActivityName>

             

            <AuthorFirstName>Long</AuthorFirstName>

             

            <AuthorMiddleInitial>X</AuthorMiddleInitial>

             

            <AuthorLastName>Nghiem</AuthorLastName>

             

            <InstitutionName>Computer Modelling Group Ltd.</InstitutionName>

             

            </Control>

            - <Control>

             

            <ControlID_i>272</ControlID_i>

             

            <ControlBegins_sdt>2015-02-23T09:00:00</ControlBegins_sdt>

             

            <ControlEnds_sdt>2015-02-23T09:30:00</ControlEnds_sdt>

             

            <ControlSpans_s>0900-0930</ControlSpans_s>

             

            <PosterBoardNumber>173234</PosterBoardNumber>

             

            <PublishingTitle>Analysis of Narrow-Boiling Behavior in Isenthalpic Flash for EOS Compositional Thermal Simulation</PublishingTitle>

             

            <AuthorBlock>D. Zhu, R. Okuno, University of Alberta</AuthorBlock>

             

            <ProgramStatusName>Accepted</ProgramStatusName>

             

            <SessionRoleStatus>Primary</SessionRoleStatus>

             

            <ActivityName>Proposal</ActivityName>

             

            <AuthorFirstName>Ryosuke</AuthorFirstName>

             

            <AuthorLastName>Okuno</AuthorLastName>

             

            <InstitutionName>University of Alberta</InstitutionName>

             

            </Control>

            - <Control>

             

            <ControlID_i>120</ControlID_i>

             

            <ControlBegins_sdt>2015-02-23T09:30:00</ControlBegins_sdt>

             

            <ControlEnds_sdt>2015-02-23T10:00:00</ControlEnds_sdt>

             

            <ControlSpans_s>0930-1000</ControlSpans_s>

             

            <PosterBoardNumber>173211</PosterBoardNumber>

             

            <PublishingTitle>A Robust Geochemical Simulator to Model Improved Oil Recovery Methods</PublishingTitle>

             

            <AuthorBlock>H. Luo, University of Texas At Austin; E.W. Al-Shalabi, ADNOC HQ HR & Admin; M. Delshad, K. Sepehrnoori, University of Texas At Austin</AuthorBlock>

             

            <ProgramStatusName>Accepted</ProgramStatusName>

             

            <SessionRoleStatus>Primary</SessionRoleStatus>

             

            <ActivityName>Proposal</ActivityName>

             

            <AuthorFirstName>Haishan</AuthorFirstName>

             

            <AuthorLastName>Luo</AuthorLastName>

             

            <InstitutionName>University of Texas At Austin</InstitutionName>

             

            </Control>

            • 3. Re: XML import to InDesign Table
              MW Design Level 4

              Ashley,


              First, it would also be good to see what a mock layout would look like. Sorry for not mentioning that previously.


              There is not going to be an automatic means of taking that XML as it stands and making a run-in template. Part of the reason is that while the "spans" will be valid for a CSS-styled web page, they will simply be ignored, complicate the task, etc. There also seem to be some characters outside of the tags (hyphens) that may simply be from the copy/paste, dunno.


              Date and time run together. That is an issue that can be dealt with in an XML editor or decent text editor. But would be, like some of these other issues, best be dealt with at the time of the data dump from your database--speaking of which, is this being exported from the same SQL database your web site is using or from say an Access database or even an Excel spreadsheet?


              Mike

              • 4. Re: XML import to InDesign Table
                aclaborn@spe.org Level 1

                Mike - thanks; below is a sample format; that isn't exactly but would be similar to the template I am trying to create.

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                 

                Also - yes don't worry about the date/time together and the chairperson tag; I have gotten that cleaned up on the XML side of things.

                 

                Not all the elements in the XML will be used in the template.  I have been successful at importing the XML in InDesign in a text box; formatting it and then having the data flow through several pages of the template; however when I try to input a table into the text box; that is where things break; it will correctly input the xml into the first text box that I created the table into; but then it won't move to the next session element and continue on with the program; it just repeats the same session in a new table.  I think this is because the table is not in my XML so once it runs through the table the XML breaks because the table element in my InDesign structure is not in my XML that I import.

                 

                I need to figure out a way to create a template for multiple different users to use with similar XML data; that looks similar to the above example; whether or not it is in a table format.  The user will not know how to modify the XML; that option is out of the question.

                 

                Our XML is being pulled out from a database software program; then is run through an upload process that cleans up the data a bit and adds in open/close tags.

                 

                Please let me know if you have any ideas....I am aware that what I have been tasked with may not be possible, but I would like to exhaust any avenues before I have to go back to my boss with the bad news.

                 

                Thanks for all your help.  Ashley

                • 5. Re: XML import to InDesign Table
                  MW Design Level 4

                  Hello Ashley,

                   

                  Sorry for the delay.

                   

                  OK. Having the data in a database *might* be a good thing. It depends on the type of front-end to the database, what types of queries can be done to it for obtaining the output, and if your organization has someone who can do such things.

                   

                  Basically your database needs either needs to inject the COLS table structure, InDesign table structure language, or Tagged Text, in the query used to obtain the data for the info in the table.

                   

                  The query can also be simply used to limit the XML to only what is pertinent to the schedule you are making. Typically these queries can be saved and reused. A better alternative to the COLS table structure for the table data would be ID table structures as 100% of the styling of the table can be accomplished...and even better might be the Tagged Text. I have never gotten the tables fully styled using CALS table structures. Close, but not 100%. But it also has never been important enough for me to try to take it further, either.

                   

                  So if I take the data from your screen shot, build a quickie publication using CALS tables for the info you can see below is in a table, it first appears like so:

                   

                  capture-002041.png

                   

                  Then if I add data and update the link to the XML, I get:

                   

                  capture-002042.png

                   

                  Which I am assuming is similar to what you need to get. This should be able to be done at the export from your database by using expressions. The same applies to actually exporting Tagged Text from the data base.

                   

                  If this is any where close to what you need, let me know. At some point, it will be easier to advise off the forum, but we need to also update this thread if there ends up being a resolution. Else it won't help other people in the future.

                   

                  Take care, Mike

                  • 6. Re: XML import to InDesign Table
                    aclaborn@spe.org Level 1

                    Mike thank you very much for that explanation.  That is very close to what we need however our database is a software program that we only have a license to and not something we own; so unfortunately we can not modify how the xml comes out of the database through the query.

                     

                    I have been thinking of a plan b, because it seems that all of the solutions, still involve someone modifying the xml before imputing it into InDesign and the staff using this template will not have that knowledge and with the amount of meeting programs we prepare - 100's a year; each with 100's of modifications before going to print - having to send the xml to be modify every single time is not really an option or efficient. 

                     

                    So on a more general question; is it possible to have multiple xml files imported into one InDesign document?  If that is possible that may provide a solution to our problem.  Please let me know your thoughts and again thank you very very much for your continued knowledge and time. 

                     

                    Ashley

                    • 7. Re: XML import to InDesign Table
                      MW Design Level 4

                      You are welcome, Ashley.

                       

                      You can opt to Append XML files. They will be placed in the order they are appended. The good news is that if you opt to link all the XML files, any changes to those individual XML files, once updated in ID, will have the changes reflected only for that XML file. That is, ID knows where each XML file is located in the ID file. The Links panel will show any changed XML file. Once that changed file is updated, then one will still need to further apply the table style as it will revert to a plain-Jane table, despite having the style

                       

                      So for instance...This XML file had the "incorrect" date.

                       

                      capture-002045.png

                       

                      ID shows the XML file as being changed. Once updated, only that XML file's changes are reflected in the ID file:

                      capture-002046.png

                       

                      Note that I did not get a notification this thread was updated. I happened to go look for it in the thread list. If it appears I have disappeared, feel free to PM me.

                       

                      Take care, Mike

                      • 8. Re: XML import to InDesign Table
                        MW Design Level 4

                        Ashley,

                         

                        I believe that with the volume of work you have for these, it might pay in the long run to hire someone to write an XSLT that will:

                        1. Remove all XML elements not needed in the layout that are present in your XML output.
                        2. Inject the table code for the elements you want in the table.
                        3. Rename the elements that need to be table elements.
                        4. Use the XSLT during import of the XML. There is an option for that in the Import XML dialog. Once saved in the template, it would provide an thorough solution.

                         

                        I am not smart enough to have a go at it, else I simply would do it for you. It would take me way too much time and I am not certain I would get it right. I can write simple XSLT files, but this would be way more involved than I have done. But there are people who can and would.

                         

                        Consider it as a future enhancement. It would save a lot of time in the long-run.

                         

                        Best regards, Mike

                        • 9. Re: XML import to InDesign Table
                          aclaborn@spe.org Level 1

                          Thanks Mike - if I did have someone to write an XSLT I think it would have to re-written for every meeting; because each program has different data.  So Meeting A has 10 sessions each with 4 papers; however Meeting B has 25 sessions each with 9 papers; so the XSLT for Meeting A would then have to be modify to be used correctly for Meeting B.  Is that a correct assumption?

                           

                          Thanks - Ashley

                          • 10. Re: XML import to InDesign Table
                            MW Design Level 4

                            Nah, the XSLT would iterate through the appropriate elements with each record's structure (of which I am still more or less unsure about), and only apply the table structure where needed. Of course, for it to work, the elements have to be named consistently, but the variable number of them really doesn't matter for each event's schedule. And as long as it was at it, the XSLT can apply the "aid:" attributes to the table elements (headers, body, table attributes, etc) so the whole document is styles appropriately.

                             

                            Mike

                            • 11. Re: XML import to InDesign Table
                              aclaborn@spe.org Level 1

                              Ok Thanks Mike - let me talk to my developer and see if he can do that for us.  Hopefully that will be the solution that will work. 

                               

                              Appreciate all the help. 

                               

                              Ashley