我试过以下代码
tell application "Adobe InDesign CS5.5"
select text of XML element 1 of active document
set xmlelem to item 1 of associated XML elements of selection
untag xmlelem
end tell
我收到了错误
"Adobe InDesign CS5.5 got an error: This element cannot be deleted."
有没有办法解开root元素?
答案 0 :(得分:0)
我认为你不能。即使您通过UI打开Structure
窗格,也无法删除或取消标记根元素(View -> Structure -> Show Structure
)。
tell application "Adobe InDesign CS5.5"
set doc to active document
untag XML element 1 of doc
end tell
-- Error: This element cannot be deleted.
您可以更改根元素的名称:
tell application "Adobe InDesign CS5.5"
set doc to active document
set name of markup tag of XML element 1 of doc to "NewRoot"
end tell