5 Replies Latest reply on Sep 28, 2006 12:54 PM by (steve_kling)

    Importing XML files

      We are using InDesign Server and importing XML files created from our web interface. Do we have to order our xml tags the same way they are define within the xml document or is there a property or method I can use that will accept a document with tags in any order?

      Thanks Steve
        • 1. Re: Importing XML files
          Dirk Becker  Level 4
          You can load the XML into a temporary document.

          Alternatively I have an experimental plugin that takes an XML file and feeds it into a javascript class that follows the SAX interface. This way you need not bother any InDesign native XML objects. One sample script produces an almost standard DOM1, out of plain javascript objects.

          This is not yet tried with InDesign Server as I currently work on different things.

          If you're interested click my name for contact info.

          • 2. Re: Importing XML files
            Level 1
            Not sure what you mean by "temporary" document? I need the Xml elements to replace text and pictures within a template created by indesign.

            Your second idea sounds interesting - I thought about writing a script that would traverse the document tree and replace text blocks and pictures, but I like your idea better.

            • 3. Re: Importing XML files
              Level 1
              I believe in CS2 the order of the incomming XML elements have to match the order of the structure in the document.
              • 4. Re: Importing XML files
                We do alot of what you described with xml.

                When I first looked at coding a solution I found Indesign's xml model to very convoluted. So we wrote a SAX parser in javascript to get the xml data into a javascript object model we create then update indesign objects from the javascript objects.

                There are open source sax parsers written in javascript if you don't have the time to write one.

                • 5. Re: Importing XML files
                  Level 1
                  Thanks Mike - I was think about the same thing.