Hi All,
Is there any AS to export XML in a single file. I have InDesign file with a lot of text frame containing contents. But Some boxes are linked and some boxes are not linked. So, when I am exporting XML then it is not exporting XML of unlink text frame.
How can I export all content of text frames in a single xml file.
Thanks
If the boxes/content aren’t ‘linked’ (I think you mean tagged) - then they aren’t part of the XML structure - and thus won’t be exported as part of the XML…becasue in fact, they aren’t. What you need to do is tag those frames/text… usually you can do this pretty quickly using the Map Tags to Styles option in Indesign. Once they are tagged and part of the XML structure - they will export like you need them to.
Chris
Hi Crish
Thanks to reply, actually bax are tagged, but those are not threaded. I think I have some confusion. Boxes are not linked mean xml tagged but not threaded. I can understand, if the xml tagged was not there then I will not get any contents at all.
I want to export all contents in a single file if boxes are not linked.
Thanks
Hi All,
I want to export xml of text frame in a folder. For it I have developed a program but as I run it, it generate the XML file but the content was not available in those files.
set XMLOutputFolder to choose folder with prompt "Select the location for exporting the XML files"
set K to 0
tell application "Adobe InDesign CS2"
set myDoc to the front document
tell myDoc
set PGcount to get count of pages
set ExportElement to every XML element of XML element 1
repeat with i from 1 to PGcount
tell page i
set BXcount to get count of text frame
repeat with j from 1 to BXcount
set K to K + 1
set K_XT to (characters -3 thru -1 of ("000" & K)) as string
select ExportElement
--set export from selected of XML export preferences to true
export ExportElement format XML to ((XMLOutputFolder as string) & "File_" & K_XT & ".xml") without showing options
end repeat
end tell
end repeat
end tell
end tell
Or i want to export XML of each page in separate files. I mean to say if my indesign document contains 15 pages then I want to create 15 xml file wich conatins contents of each page.
I am waiting for any response from your side.
Thanks
Hi Chris & All
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
What I do in cases like this: add a ‘display dialog’ line, so in this case:
display dialog cleanname
if given an error on display dialog you still can see in the error message the content of the variable
i guess (i don’t have write anything with xml yet) there are 2 possible reasons:
- the name of the variable is nog correct (you can see that in display dialog command)
- or it has something to do with prefrences: you must first make a new xml tag with that name for using him
just a hint, test it yourself
Hi,
I have tried to test it and solve the problem. But I am still on the same page. Actually I want export XML. I have InDesign document with a lot of tables, gaphics, and marginal notes. At the time of composition operator didn’t link those things and finished the entire project, they are also don’t have any idea about XML so this type of error happened at the time of composition. Now they want XML from those files, since it was previously xml tagged.
I want to export all contents with xml tag in a single file inspite of unlinked text frame. Or any other fast way to do it. Or any script to link all those text frame in the document, so that operator will get a single file of XML.
Thanks