2 Replies Latest reply on Dec 22, 2011 10:32 AM by wildtravel

    Formatting text in imported xml

    wildtravel Level 1

      I am importing xml into an Indesign document and I would like to format text within an element.


      I can apply the adobe cstyles to the element <description> but not within the element


      sample xml:

      <importthis xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">

      <description>I only want <em>this in italics</em>, and <strong>this text should be bold</strong>.</description></importthis>


      If I add the cstyle to the decription element <description aid:cstyle="italic"> it will italicize the entire paragraph, which we don't want


      We want InDesign to be able to recognize the <em> and <strong> tags without having to pre-tag the data in Indesign. The data changes constantly and each time there is a change to the bold and italic words, Indesign does not see them at all. It sees them as xml elements and just drops them. Does anyone know how Indesign handles these behind the scenes and if we should be using different mark up or encoding besides <em> or <strong>?

        • 1. Re: Formatting text in imported xml
          John Hawkinson Level 5

          As I understand it, you should have <description> mapped to a paragraph style, and <em> and <strong> mapped to character styles. Is that what you have set up?


          When you say "each time there is a change," that suggests the import works initially but then when you re-import the same XML you lose data? Is that correct?


          It should not matter what your tag is named.

          • 2. Re: Formatting text in imported xml
            wildtravel Level 1

            Hi John,


            Lets see if I can explain this better:


            Yes, we can map to character styles. And we can import an xml document with these elements, and manually tag them <em> or <strong> in InDesign, and it works. If we re-import the same exact xml, or slightly different xml but with the tagged elements in the same order and number, it works.


            If we import new data with <em> or <strong> tags that haven't been pre-tagged in InDesign, we lose the data. We have to go back to the InDesign document and manually retag the element. If we switch the order of <em> or <strong> in the data, the text is dropped, and we have to manually tag the new elements into the InDesign document.


            ex #1: <description>Here is our first sentence in <strong>bold</strong> then <em>italic</em>.</description>


            if I tried to change the data and reimport a slight change:


            ex #2: <description>Here is our first sentence in <em>italic</em> then <strong>bold</strong>.</description>


            If we changed the data in the xml as in example 2, and try to reimport this, the data between the <em> and <strong> tags completely dissappears.


            InDesign treats the <em> and <strong> tags as xml elements, which makes sense after all. We need a finer level of granularity.


            I hope that makes sense!