🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19728

import xml into different textframes

#19728
From: bart knaap
Date: Tue, 26 Nov 2002 09:36
39 lines
2373 bytes
I would really appreciate if someone has got a simple approach to the following problem: 
I just want to import an xml file and pickout the elements with the same name an put them into an 
textframe ,then an other element with an different name into an other text frame ,an so on 
There must be an simple way to do this but as far as i am with my script it`s just replacing 
the textframe with an other textframe .An not putting the new element into the the textframe on an 
new line 
I know there's something real simple that I'm missing. Just can't figure out what it is. 

here`s the xml an the script i`m using 
(*<?xml version="1.0" encoding="UTF-8"?> 
<artikel> 
		<artnr>100.01</artnr>artn 01 
		<artnr>100.02</artnr>artn 02 
		<artnr>100.03</artnr>artn 03 
		<artnr>100.04</artnr>artn 04 
		<artnr>100.05</artnr>artn 05 
</artikel>*) 
set myXMLFile to "Macintosh HD:Users:myname:Desktop:test.xml" 
set myFoundXMLElements to {} 
tell application "InDesign 2.0.1" 
	set myDocument to make document 
	tell myDocument 
		import XML from (myXMLFile as string) 
		tell XML Element 1 
			repeat with myCounter from 1 to (count XML Elements) 
				set myXMLElement to XML Element myCounter 
				if name of markup tag of myXMLElement is "artnr" then 
					copy myXMLElement to end of myFoundXMLElements 
				end if 
			end repeat 
		end tell 
		set myTextFrame to make text frame with properties {geometric bounds:{5, 5, 100, "200"}} 
		repeat with myCounter from 1 to (count myFoundXMLElements) 
			tell myTextFrame 
				set associated object of item myCounter of myFoundXMLElements to myTextFrame 
			end tell 
		end repeat 
	end tell 
end tell
Technical Details
Message-ID: <1de6c2cd.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,621c5d1e51780b6a,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-11-26 01:38:03 PST
From: "bart knaap" <bart.knaap@plantijncasparie.nl>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: import xml into different textframes
Message-ID: <1de6c2cd.-1@WebX.la2eafNXanI>
Date: Tue, 26 Nov 2002 01:36:55 -0800
Lines: 47
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit