马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;|
- 2 attribute
- 3 "TEXT"
- 4 "CDATA"
- 8 "COMMENT"
- |;
- ;;("ATTR" "test") or ("ATTR" ("lang" "en"))
- ;;(("ATTR" ("lang" "en")) ("TEXT" "dddde" "ddere") ("COMMENT" "dfafa" "fasfdsa") ("CDATA" "fadsfsa" "fdasfa" "adafa"))
- (defun XD::XML:SetNodeProperties
- (xmlobj lst / _getnodeType _setattribute _setproperty doc)
- (defun _getnodeType (str)
- (setq str (strcase str))
- (cond
- ((= str "ATTR") 2)
- ((= str "TEXT") 'createTextNode) ;_
- ((= str "COMMENT") 'createComment) ;_
- ((= str "CDATA") 'createCDATASection) ;_
- (t nil)
- )
- )
- (defun _setattribute (node lst)
- (if (= (type lst) 'STR)
- (setq lst (list "atttribute" lst))
- )
- (vl-catch-all-apply
- 'vlax-invoke-method
- (append (list node "setAttribute") lst)
- )
- )
- (defun _setproperty (node func lst /)
- (setq element (vlax-invoke-method
- (vlax-get-property node 'ownerDocument)
- func
- ""
- )
- )
- (vlax-put-property element 'text lst)
- (vlax-invoke-method node 'appendChild element)
- )
- (if (= (vlax-get-property xmlobj 'nodeType) 9)
- (setq doc xmlobj)
- (setq doc (vlax-get-property xmlobj 'ownerDocument))
- )
- (mapcar
- '(lambda (x)
- (mapcar '(lambda (a / typ tag att)
- (setq typ (_getnodeType (car x)))
- (if (= typ 2)
- (_setattribute xmlobj a)
- (_setproperty xmlobj typ a)
- )
- )
- (cdr x)
- )
- )
- lst
- )
- )
|