TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: psuchewinner on May 14, 2008, 09:30:17 AM

Title: Getting info from an XML file
Post by: psuchewinner on May 14, 2008, 09:30:17 AM
Can ayone tell how the retreive info from an XML document using Visual Lisp?

Like listing the "Children" from the "Parent"?
Title: Re: Getting info from an XML file
Post by: daron on May 14, 2008, 09:33:25 AM
It doesn't appear that too many people have delved into XML with lisp and the two people I know that did, don't visit here much if at all anymore. If you go to Columbia's profile, you might be able to email him or at least send him a personal message.
Title: Re: Getting info from an XML file
Post by: psuchewinner on May 14, 2008, 09:44:04 AM
Thanks, I was thinking about that.
Title: Re: Getting info from an XML file
Post by: daron on May 14, 2008, 10:13:04 AM
Seems to have worked. Long time no see, Columbia.
Title: Re: Getting info from an XML file
Post by: Columbia on May 14, 2008, 10:13:47 AM
I'm still around, Daron, I just don't have the time to lurk and respond as I used to.  :(

Besides, it seems by the time I get to a topic, about 600,000 people have already answered the question that was asked.  I feel a little redundant saying the same thing somebody else has said.
Title: Re: Getting info from an XML file
Post by: Keith™ on May 14, 2008, 10:31:29 AM
Here is a little something to point you in the right direction ... it could be improved substancially but I think it will give you some ideas about how to proceed.

Code: [Select]
(defun mlchild(/ doc xmldoc xmlchildren)
  (vl-load-com)
(if (= xmlc-NODE_TEXT nil)
(vlax-import-type-library
  :tlb-filename "msxml2.dll"
  :methods-prefix "xmlm-"
  :properties-prefix "xmlp-"
  :constants-prefix "xmlc-")
)
(setq doc (getfiled "" "" "" 8))
  (setq xmldoc (vlax-create-object "Microsoft.XMLDOM"))
  (xmlm-Load xmldoc doc)
  (setq xmlchildren (vlax-get xmldoc 'childNodes))
  ;;; work on the child nodes here ... there may be nested child nodes!!
  ;;; don't forget to release your objects ;)
)
Title: Re: Getting info from an XML file
Post by: psuchewinner on May 14, 2008, 10:38:52 AM
Thanks for the help.

You know?, It weird, I usually catch on to this stuff pretty fast but this is new to me and I am struggling.

I will chew on this.
Title: Re: Getting info from an XML file
Post by: daron on May 14, 2008, 10:49:22 AM
I'm still around, Daron, I just don't have the time to lurk and respond as I used to.  :(
That's good to hear. I had wondered if you had gone the way of the dodo bird.