1 Reply Latest reply on Apr 13, 2012 11:09 AM by Graham vdR

    XML: Using static & placeholder text inside element with children?

    Graham vdR Level 1

      Hi there

       

      I’m working with simple XML data with the following structure:

       

      Root

           Row

                Company_name

                Physical_address

                Phone

                Website

                Email_address

           Row

                Company_name

                Physical_address

                Phone

                Website

                Email_address

       

      etc.

       

      The row element will be repeated many times. In setting up my InDesign document I’d like to use static text within each Row element. What’s confusing me is where I should use the Row tag. I’d like my imported XML data to run as continuous text, thus:

       

      Company: placeholder text

      Address: placeholder text

      placeholder text

      placeholder text

      placeholder text

       

      Company: placeholder text

      Address: placeholder text

      placeholder text

      placeholder text

      placeholder text

       

      I tried setting it up like this, with the parent text frame given the Root tag:

       

      <Row>Company: <Company_name>placeholder text</Company_name>

      Address: <Physical_address>placeholder text</Physical_address>

      <Phone>placeholder text</Phone>

      <Website>placeholder text</Website>

      <Email_address>placeholder text</Email_address></Row>

       

      …but when I import my XML file I lose all my static text and each child element is indented more than its parent element. I would guess that by placing my static text within the Row tag it gets replaced when each Row element is imported, but where else would I place it? Do I have to create anchored text frames (tagged with Row) within the Root frame to hold each Row element?

       

      I’d appreciate any insights.

       

      Message was edited by: Graham vdR

        • 1. Re: XML: Using static & placeholder text inside element with children?
          Graham vdR Level 1

          OK, I’ve figured out the first problem. I just needed to play around with the options in the dialogue that comes up when importing XML. Specifically, the “Do not import contents of whitespace-only elements” needs to be checked. I still don’t see why that should affect whether or not my static text stays in place.

           

          Now, my new question is this: It looks like all the child elements of a container element have to appear in the document in the same order in which they appear in the XML file. Is this right? If I swap my Email_address and Website tags around in my placeholder text, either the email address disappears or it appears at the end (depending on the options I select in the dialogue upon import). So if I want to change the order in which they appear I have to do so in the XML file as well?