🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8959

Re: XML Export

#8959
From: rajeevkumar
Date: Sat, 16 Sep 2006 12:32
51 lines
2335 bytes
Hi Dave

Thanks a lot, below is the code which a have, but there is a problem, can you tell me how can I correct it.

=================
set thePath to choose file name with prompt "Select file for XML export"
tell application "Adobe InDesign CS2"
	set properties of XML export preferences to {file encoding:UTF8, view after export:true, export from selected:false, image conversion:automatic, copy original images:true}
	set styleList to name of every paragraph style of document 1 whose name is not "[No paragraph style]"
	tell document 1
		repeat with i from 1 to count of styleList
			set cleanName to my RemoveIllegal(item i of styleList)

			set XMLTag to make XML tag with properties {name:cleanName}
			set XMLMap to make XML export map with properties {markup tag:XMLTag, mapped style:paragraph style (item i of styleList)}
		end repeat
		auto tag
	end tell
	export document 1 format XML to thePath
end tell
styleList

on RemoveIllegal(theString)
	set tempString to theString
	repeat with eachItem in {" ", "[", "]"}
		if contents of eachItem = " " then
			set theReplace to "_"
		else
			set theReplace to ""
		end if
		set oldDelim to AppleScript's text item delimiters
		set AppleScript's text item delimiters to eachItem
		set theList to text items of tempString
		set AppleScript's text item delimiters to theReplace
		set theText to theList as string
		set AppleScript's text item delimiters to oldDelim
		set tempString to theText
	end repeat
	return tempString
end RemoveIllegal

===============

I am getting the error "The tag you are trying to create has an invalid name" and the line is

			set XMLTag to make XML tag with properties {name:cleanName}
at cleanName.

Please do some needful if you can.

Thanks
Technical Details
Message-ID: <3bc1a25e.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.isoc.lu!webcrossing
References: <3bc1a25e.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,34db7ffeb087eeca
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: rajeevkumar@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: XML Export
Message-ID: <3bc1a25e.2@webcrossing.la2eafNXanI>
Date: Sat, 16 Sep 2006 05:32:00 -0700
References: <3bc1a25e.-1@webcrossing.la2eafNXanI>
Lines: 58
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit