8 Replies Latest reply on Mar 4, 2015 7:48 AM by FfejNS

    Tagging in Story Editor messing up Structure


      I have an XML file that looks like this:


      <?xml version="1.0" encoding="utf-8"?>

      <MailItem attribute1="value1" attribute2="and so on...">


           <CustomerName>Mr. Bray</CustomerName>


           <AndOtherElementsToo>Which are not important right now</AndOtherElementsToo>



      It's important to note that this document will only ever have ONE <MailItem> (gauranteed), which makes it a root element. I've tried wrapping this in ANOTHER root element called <MailJob> but that caused problems too. More on that in a minute.


      I have an InDesign Template that is very straightforward. No tables, nothing. I import my XML file into my TAGS panel and I go to town tagging various text placeholders with things like Mail_ID, and Sale_Date.  I perform a test IMPORT XML and things look great.  A minor annoyance is if the elements are not in the correct order in the STRUCTURE pane, they won't import correctly, but I can engineer around this by ensuring the elements are produced in a static order. So far so good.


      The problem comes when I go to the "letter" part of my template. It begins, "Dear So And So," (literally).  Since I want "So And So" to be the actual name from my data, I need to tag this. I open this up in the Story Editor (since I only want PART of the text replaced) and I select "So And So" and I select the CustomerName tag from my Tag panel.


      What happens next is where the wheels come off the wagon and I am in desperate need of help. As SOON as I tag it, three things happen:

      1. The tag appears in the Story Editor. Looks nice. No problem here
      2. A new TAG appear in my TAG pane called "Story"
      3. My Structure pane creates a new element called Story and nests a new element, CustomerName underneath it


      When I perform a test import now, the greeting on the letter doesn't get replaced (the data doesn't import) because, duh, the structure doesn't match the data coming in. It's looking for <MailJob><Story><CustomerName>Mr. Bray</CustomerName></Story></MailJob> which I do not have in my XML file.


      I learn that setting the Tag Preset Options allows me to change the "Story" default to any pre-existing tag. Great!  This solves problem #2 above (the "Story" tag no longer gets created in my TAGS panel).  But problem #3 still happens; My structure now looks like this:


      • MailItem
        • Mail_ID
        • CustomerName
        • Sale_Date
        • MailItem "Dear So And So,"
          • CustomerName


      Arg!  All manners of attempting to drag and drop the new, nested CustomerName element to higher in the Structure results in the text being UNTAGGED in the placeholder and the process begins again when I try to fix it.


      I thought for a moment that maybe tags embedded within the story editor need to live within a second-level element instead of right under the root element, so I wrapped the whole XML file in <MailJob> </MailJob> elements. This only proceeded to make it impossible to have normal one-to-one text placeholders import/replace correctly (even after I reloaded the tags in the TAGS panel from the newly wrapped file). I didn't even bother testing the within-Story-Editor tags since this is a deal breaker right off the bat.


      I can't simply reformat the XML to match what InDesign is expecting because we have ONE xml format (and exporter) for hundreds of document layouts. I *really* don't want to applying XSLT for every quirky change the design group wants to make (e.g. "We want to suddenly start using the state name in the text of the letter, can you update the XSLT file?"), and besides, we run GIANT jobs (thousands of individual documents) and XSLT processing EACH XML file will slow things down more than I want (I've already got a slow process upstream I'm dealing with, I don't want to make it any slower)


      I'm going crazy, the pressure is on, and I'm desperate for help.  Why can't I get existing XML elements to import INSIDE of a placeholder (along with static text or other elements) the same way they do when I tag an entire placeholder? What am I doing wrong?

        • 1. Re: Tagging in Story Editor messing up Structure
          MW Design Level 5

          Have you tried underscoring your So_and_So text?


          In any case, here's what I get.






          Brining in the XML, I get:




          Importing a new XML, I get:




          Want the sample file?



          • 2. Re: Tagging in Story Editor messing up Structure
            FfejNS Level 1

            Yes please. I'm not 100% sure how you did that. Whenever I tag text with the story editor within a text placeholder, it creates a NESTED element in the structure. Yours didn't do that (yours went MailItem>CustomerName ... mine creates MailItem>MailItem>CustomerName). I have no clue how you managed to do that.

            • 3. Re: Tagging in Story Editor messing up Structure
              MW Design Level 5

              I normally tag in the working space versus the Story Editor. But it makes no difference. Sometimes the SE is the only means of seeing exactly what is being tagged, though.


              XML in ID isn't as "easy" as I think it ought to be (rather, could be). It can seem ID is working against one in a misguided attempt to help. This template took a couple tries to get right...and sometimes, especially if I am tired, nothing seems to go right when it comes to XML. But it's most often well worth it in the end.


              Dropbox - XML-FfejNS.zip



              • 4. Re: Tagging in Story Editor messing up Structure
                FfejNS Level 1

                Ok, for prosperity's sake, the difference between our documents appears to be this:


                In your structure pane, your root element had an icon of a letter "T" with lines of text.  In mine, my root element icon looked like "<>". This appears to make all of the difference.  When I drag my "<>" root element from STRUCTURE onto my page, the icon changes and a new text placeholder appears. Further, tagging text in the new placeholder works great (as expected). Whenever this text placeholder is selected, the root element underlines in the STRUCTURE pane.


                When I go back to one of my other text placeholders, the root element does NOT underline. It appears to be a completely different beast. Tagging it as the root element doesn't fix it either, it makes it worse (by creating a new sub-element by the same name as the root element). Further, any new text placeholders I create behave the same as my original one (no underline, etc.) There is something different about these text placeholder objects that I cannot identify anywhere in a dialog or setting.


                On the surface, it would appear that the answer is to create my text placeholders by dragging the root element from the structure into the document design


                Here's the disturbing part and is very much still a problem.  As soon as I want TWO text placeholders to behave the way I want, I cannot do it. Only one placeholder will "work" (as in your example) at a time. As soon as there are two, one will cease working and one will begin working anew.


                My document contains several text placeholders, each of which needs to be tagged in this manner.

                • 5. Re: Tagging in Story Editor messing up Structure
                  MW Design Level 5

                  I am not following the two placeholders thing. My brain's tired...


                  It might help if you uploaded a sample document. Assuming it is private, feel free to PM me a download link. Only then can we really be discussing apples to apples. If a sample isn't private, just plop a download link here in the forum thread.



                  • 6. Re: Tagging in Story Editor messing up Structure
                    FfejNS Level 1

                    First of all, I can't thank you enough for helping me. THANK you.


                    I've thrown up an example on my Google Drive.


                    Just read the text I typed in the placeholders and it should become clear.

                    • 7. Re: Tagging in Story Editor messing up Structure
                      MW Design Level 5

                      No worries. I think I see what you are wanting.


                      XML is a single-stream text flow. Once you create multiple frames, ID considers those frames separate stories. For an example, click into the top frame and search for the word prove. Unless ID is set to search the document, ID will not find the word as it only occurs in the second frame. ID applies this to XML, which like importing a Word document, needs to be told where to go when there are multiple frames.


                      A couple choices.

                      Thread the frames. This then will work without fuss--if it works for your design.

                      Change the XML to reflect non-threaded frames. In the screen shot I made a quick XML and imported it. Now, I wouldn't recommend multiple Root elements, but this is quick and dirty.




                      And the XML that goes with it is:

                      <?xml version="1.0" encoding="utf-8"?>
                      <TagA>TWO STORIES</TagA>
                      <TagB>CHANGE THE XML</TagB>
                      <TagC>TO MATCH STRUCTURE</TagC>



                      • 8. Re: Tagging in Story Editor messing up Structure
                        FfejNS Level 1

                        Thanks, this is what I will do.  Why, oh why, Adobe, do you not simply allow re-use of elements instead of enforcing a 1:1 binding?


                        Thanks for all of your time on this Mike, I'm indebted to you.