马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 st788796 于 2014-2-7 21:29 编辑
- (defun XD::XML:AddChildNodes (parent namelst / xmlDoc root)
- (if (and (= (vlax-get-property parent 'nodeType) 9)
- (not (vlax-get-property parent 'documentElement))
- )
- (progn
- (setq xmldoc parent
- root (vlax-invoke-method parent 'createElement (car namelst))
- )
- (vlax-put parent 'documentElement root)
- (setq parent (vlax-get-property parent 'documentElement)
- namelst (cdr namelst)
- )
- )
- (setq xmlDoc (vlax-get-property parent 'ownerDocument))
- )
- (if (not parent)
- (setq parent xmlDoc)
- )
- (mapcar '(lambda (x / newElement)
- (if (setq newElement
- (vl-catch-all-apply
- 'vlax-invoke-method
- (list xmlDoc 'createElement x)
- )
- )
- (if (not (vl-catch-all-error-p newElement))
- (vl-catch-all-apply
- 'vlax-invoke-method
- (list parent 'appendChild newElement)
- )
- )
- )
- )
- namelst
- )
- )
|