Article View: adobe.scripting.indesign
Article #9271Importing xml, automatically
From: dan_tellit
Date: Thu, 24 Aug 2006 06:03
Date: Thu, 24 Aug 2006 06:03
30 lines
1832 bytes
1832 bytes
Hi , I have a xml file that i manually import into my indesign(cs2) file. I have all my tags and structure in place and it works fine. (using File < Import xml)
As the imported xml filename never changes name or location (just the data inside it) is it possible to have a script to do this importing easily enough?
My xml file is always at c:\1.xml and ive had a look at this forum and am experimenting around this syntax:
myFile = File("c:\1.xml")
app.activeDocument.xmlElements.item("Templates").xmlElements.item
("collection").importXML(myFile);
And not suprisingly it doesnt work because i assume JAVA is no guessing language (lol) ((I have no idea what the "Templates" string is for above
my xml looks like this ("bold" and "plain" fields)
-------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Story><bold>Blindly</bold><plain> he ploughed through gaining ~</plain></Story>
-------------------------------------------------------------
This xml wouldnt post properly to forum , sorry
My element structure in indesign file looks like:
Root
Story
bold
plain
-------------------------------------------------------------
Any help appreciated
Regards
Dan
Technical Details
Message-ID:
<3bc1607f.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news.ecp.fr!news.stben.net!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,7c703fae289d0985,start X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: dan_tellit@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Importing xml, automatically Message-ID: <3bc1607f.-1@webcrossing.la2eafNXanI> Date: Wed, 23 Aug 2006 23:03:11 -0700 Lines: 41 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news.ecp.fr!news.stben.net!webcrossing