这是一个Photoshop 的xml.js 库的一个对象方法,我不会英语,用 有道翻译 的又看不懂..请有空的人能教教我怎么用吗?我只能用点赞汇报大家了,谢谢...replace()
xmlObj.replace (name, value);
name
An element or attribute name, with or without the 0-based position index of a
specific element, or the wildcard string “*”.
? If no position index is supplied, replaces the value of all matching elements.
? If the wildcard is supplied, replaces the value of all contained elements. When anelement contain subelements, those are removed,
and only the replacementvalueremains.value An XML object or any value that can be converted to a String with toString().
Replaces one or more property values in this node.If the named element does not exist, appends the given value as a text element.
Returns this XML object.
setChildren()
xmlObj.
1 回答

海绵宝宝撒
TA贡献1809条经验 获得超8个赞
这是个替换函数。
name是你需要替换的元素或属性名,可以指定下标index,或者通选符‘*’。
如果不提供下标,所有符合name的元素都会被替换。
如果是‘*’,替换所有包含的元素,如果元素有子元素,则直接移除。
value是个XML对象或者任何能被toString()函数转换为字符串的值。
特殊情况:如果name不存在,则直接将value作为一个文本元素append进去。
返回的是XML对象。
添加回答
举报
0/150
提交
取消