Sub SetElementXdata(xdEle As Element, xdAppName As String, xdType As MsdXDatumType, xdValue)
Dim Xdata() As XDatum

If xdEle.HasAnyXData Then
Xdata = xdEle.GetXData(xdAppName)
End If

'AppendXDatum Xdata, msdXDatumTypeControlString, "{"
AppendXDatum Xdata, xdType, xdValue
'AppendXDatum Xdata, msdXDatumTypeControlString, "}"

xdEle.SetXData xdAppName, Xdata
End Sub

严格的讲,这段代码不完善,特别是给已有扩展数据的元素添加相同应用程序名称和相同类型的扩展数据时,也算是留点思考的空间吧!