7 Replies Latest reply on May 6, 2013 11:58 AM by MW Design

    How to import repeated data cells with XML?

    IRISccg

      Hello!

       

      I have some little troubles with the XML import functionality.

       

      Let's consider a billing table:

       

      ItemPrice
      Tax percentageVATTotal price
      Item description$8020%$20$100
      Total$80
      $20$100
        • 1. Re: How to import repeated data cells with XML?
          MW Design Level 4

          What trouble are you having? Your post doesn't identify what the issue is.

           

          If you want to see what your XML source should be structured like, create a table, add the appropriate data, and export it as XML. Open it in a text editor. Make your output from however the data is generated be like it.

           

          Take care, Mike

          • 2. Re: How to import repeated data cells with XML?
            IRISccg Level 1

            Yes, I just missused Ctrl+S, and I posted my question too early. Then I lost the update of my question

            I'll have to re-type the whole stuff..

             

            Well, here is a shot version of the question; this is what I get when importing XML:

            ItemPrice
            Tax percentageVATTotal price
            Item description$8020%$20$100
            Item description$8020%$20$100
            Item description$8020%$20$100
            Total$80
            $20$100

             

            The XML structure repeats the cells. But, in InDesign, new lines are not generated accordingly: extra cells are added to the last cell of the line...

            Thanks

            • 3. Re: How to import repeated data cells with XML?
              MW Design Level 4

              Yes, the forum software I love to hate...

               

              Hmm, haven't seen a repeat unless the XML data is malformed. And it appears in the screen shot that a table is inserted into a table? (Well, both repeats appear to be tables in tables).

               

              In a new document, I would begin with creating the data as per your first screen shot (if that is how you want the data), export to XML and compare it to a single node in your imported XML. Cause it looks like unclosed or repeated data.

               

              Mike

              • 4. Re: How to import repeated data cells with XML?
                IRISccg Level 1

                I may have to rephrase my question (those are not screenshots, but attempts to simulate the InDesign rendering ).

                 

                The repeat behaviour is expected :

                I would like to get this in InDesign:

                - Title    | Title     | Title   | Title

                - Item 1 | Price 1 | Tax 1 | Total 1

                - Item 2 | Price 2 | Tax 2 | Total 2

                - Item 3 | Price 3 | Tax 3 | Total 3

                 

                But I get this in InDesign after import:

                - Title    | Title     | Title   | Title

                - Item 1 | Price 1 | Tax 1 | Total 1 | Item 2 | Price 2 | Tax 2 | Total 2 | Item 3 | Price 3 | Tax 3 | Total 3

                 

                The XML for this section looks like this :

                <table>

                     <cell>Item 1</cell>

                     <cell>Price 1</cell>

                     <cell>Tax 1</cell>

                     <cell>Total 1</cell>

                     <cell>Item 2</cell>

                     <cell>Price 2</cell>

                     <cell>Tax 2</cell>

                     <cell>Total 2</cell>

                     <cell>Item 3</cell>

                     <cell>Price 3</cell>

                     <cell>Tax 3</cell>

                     <cell>Total 3</cell>

                </table>

                 

                There is no line distinction in XML. However, if I understood the documentation well, this is the way of doing it. I exported an InDesign table to XML and there is no line distinction either...

                 

                Also, I checked my source XML file with an online validator, and no errors were found.

                 

                I also tried this :

                1. Create a several-lines table with InDesign, and filled up
                2. Export the document to XML
                3. Delete data in the InDesign table, and delete all lines but one
                4. Import XML

                I get the same error : extra cells are added next to the last one.

                Indeed, the last cell has to be widely extended to receive all this data. If not, this alert appears: "Cells too small to be split".

                • 5. Re: How to import repeated data cells with XML?
                  MW Design Level 4

                  I quickly modified an existing XML I am working on. Try this.

                   

                  <Prices>

                  <table>

                  <tgroup cols="4">

                  <colspec colname="1"/>

                  <colspec colname="2"/>

                  <colspec colname="3"/>

                  <colspec colname="4"/>

                  <thead>

                  <row>

                  <entry>Item</entry>

                  <entry>Price</entry>

                  <entry>Tax</entry>

                  <entry>Total</entry>

                  </row>

                  </thead>

                  <tbody>

                  <row>

                  <entry>Item 1</entry>

                  <entry>Price 1</entry>

                  <entry>Tax 1</entry>

                  <entry>Total 1</entry>

                  </row>

                  <row>

                  <entry>Item 2</entry>

                  <entry>Price 2</entry>

                  <entry>Tax 2</entry>

                  <entry>Total 2</entry>

                  </row>

                  <row>

                  <entry>Item 3</entry>

                  <entry>Price 3</entry>

                  <entry>Tax 3</entry>

                  <entry>Total 3</entry>

                  </row>

                  </tbody>

                  </tgroup>

                  </table>

                  </Prices>

                  • 6. Re: How to import repeated data cells with XML?
                    IRISccg Level 1

                    I did not manage to use your structure. InDesign would add a Table>Cell structure, not allowing any intermediate tags.

                     

                    However, I found a workaround to the described bug.

                    I would pre-create a large number of lines (more than the expected records of the database, which are supposed to be exported to XML)

                    Then, at XML import, I delete useless extra elements.

                    At the end, I get the expected result, with just the required number of lines in the table.

                     

                    Thanks anyway !

                    • 7. Re: How to import repeated data cells with XML?
                      MW Design Level 4

                      I'm not thinking there is a bug, but rather a communication error between what you write and what I think it means. If you needed a different structure, it would have been good to know exactly how you wish for the import to lay out as.

                       

                      In the end, glad you worked it out.

                       

                      Mike