Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XML Schema for Variable Library

Community Beginner ,
Mar 03, 2010 Mar 03, 2010

Here's a description of what I am trying to accomplish:

I have to typeset mulitples of the same text information into four illustrator ads/posters for many locations. So I have used the variables panel to create templates using datasets and variable libraries. I am under the impression that the next step is to use Excel to input the information into a spreadsheet that is mapped to the XML document output by Illustrator and then output it again with more information. After that I would write an action to iterate through the datasets and save them as PDFs. This would save me time in ensuring that all the info has the correct font settings.


Here's my problem:

How do I write an XML schema for the Illustrator XML so that Excel will understand it?

I found some links online, but if there's an easier way or if anyone else has an example for this one, that would be appreciated.

TOPICS
Scripting
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Beginner ,
Mar 05, 2010 Mar 05, 2010

Here's what I came up with:

<?xml version="1.0"?>

<schema xmlns="dataset.xsd"
targetNamespace="dataset.xsd"
elementFormDefault="qualified">
   
    <element name="sampleDataSets">
    <complexType>
        <sequence>
            <element name="sampleDataSet" minOccurs="0" maxOccurs="unbounded">
             <attribute name="dataSetName" type="string" use="optional"/>
                  <complexType>
                        <sequence>
                                <element name="DateVar" type="string"/>
                                <element name="OldAddress" type="string"/>
                        <element name="LocationVar1" type="string"/>
                        <element name="TimeVar1" type="string"/>
                        <element name="LocationVar2" type="string"/>
                        <element name="TimeVar2" type="string"/>
                        <element name="LocationVar3" type="string"/>
                        <element name="TimeVar3" type="string"/>
                        <element name="LocationVar4" type="string"/>
                        <element name="TimeVar4" type="string"/>
                        <element name="TemplateVar" type="string"/>
                        </sequence>
                  </complexType>
            </element>
        </sequence>
    </complexType>
   </element>

</schema>

This generates a map in Excel for only the sampleDataSet XML hierarchy. You would then have to copy and paste them into the variable library and do a copy and replace to massage some of the tags which will have XSI: in front of them.

Anyone know how to fix it so that v: will be appended before the dataset tag?

I can actually get to the point where the variable library is loaded into Illustrator, but when I switch to the first dataset, all the text field objects are blank. Any idea what could be happening?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 05, 2010 Mar 05, 2010

Oh, I figured that out too.... in order to have text in an XML file populate text fields, you have to include the <p></p> inside of each XML tag that pretains to a text field.

Thanks for developing this functionality Adobe, you'll be saving me hours.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 11, 2010 Mar 11, 2010
LATEST

Here's a script I wrote to cycle through datasets and save each one as a new PDF:


/* Plain English Description of DataSet Script

1. Document is open with Variable Library loaded.
2. Load first dataset.
3. Set PDF save options.
4. Set path to save in.
5. Save file as "[dataset name].pdf".
    a. Get name of dataset.
    d. Loop through length of datasets.
    e. current set
    f. Save file as "[dataset name].pdf".
6. Load next dataset.
7. Continue until last dataset.
*/

//$.bp();    //    Uncomment this line to cause the script to be run in the JavaScript debugger window.

var aDocument = app.activeDocument;

//dataset var
var dSets = aDocument.dataSets;
   
//document variables for PDF Sve
                        //var origName = app.activeDocument.name;
                        //var docPath = app.activeDocument.path;   
                        //var docPathStr = docPath.toString();
var pdfSaveOptions = new PDFSaveOptions();

    /*pdfSaveOpts.acrobatLayers = true;
    pdfSaveOpts.colorBars = true;
    pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
    pdfSaveOpts.compressArt = true; //default
    pdfSaveOpts.embedICCProfile = true;
    pdfSaveOpts.enablePlainText = true;
    pdfSaveOpts.generateThumbnails = true; // default
    pdfSaveOpts.optimization = true;
    pdfSaveOpts.pageInformation = true;
    pdfSaveOptions.preserveEditability = true;*/
    pdfSaveOptions.pDFPreset = "TTL March";

var newPath = "file://C:/Documents and Settings/YouName/My Documents/PDFoutput";

for (i = 0; i < dSets.length ; i++){
   
    //this part switches to the current 'i' dataSet
    currentSet = dSets;
    setName = currentSet.toString();
    alert ("Current set = " + currentSet );
    currentSet.display();
   
    //this part save the file as a new PDF with the current dataset

   
    documentPath = newPath + "/" + setName + ".pdf";
    alert("Saved to: " + documentPath);
       
    theFile = new File(documentPath);
    aDocument.saveAs(theFile, pdfSaveOptions);
    }
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines