Author Topic: External Data Storage with XML and VLISP  (Read 33864 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
External Data Storage with XML and VLISP
« Reply #15 on: January 06, 2004, 10:40:09 AM »
>and Cue comment from Dent....
you just _had_ to say something............. :D
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
External Data Storage with XML and VLISP
« Reply #16 on: January 06, 2004, 11:19:40 AM »
Oh... where is dent... I know he just can't leave this one alone
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

deegeecees

  • Guest
External Data Storage with XML and VLISP
« Reply #17 on: January 06, 2004, 02:21:42 PM »
I'm not so sure I wanna see em now.... :D

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
External Data Storage with XML and VLISP
« Reply #18 on: January 07, 2004, 11:42:35 AM »
The xml-api is available here.

http://www.theswamp.org/swamp.files/xml-api/

Thanks Columbia.
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10603
External Data Storage with XML and VLISP
« Reply #19 on: January 07, 2004, 11:53:39 AM »
now that is exactly what i was thinking sofar! Awesome!

Ive got so many ideas floating arround in my head now!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

daron

  • Guest
External Data Storage with XML and VLISP
« Reply #20 on: January 07, 2004, 12:02:01 PM »
Looks cool. How do we work this stuff?

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
External Data Storage with XML and VLISP
« Reply #21 on: January 07, 2004, 12:15:02 PM »
I'm currently working on some more examples. Maybe we could have a thread dedicated Columbia's xml-api , if he doesn't mind that is.
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
External Data Storage with XML and VLISP
« Reply #22 on: January 07, 2004, 12:24:13 PM »
dent must be out to pasture

Columbia

  • Guest
External Data Storage with XML and VLISP
« Reply #23 on: January 07, 2004, 12:37:53 PM »
Okay,  it looks like we need a little explanation/tutorial/crystal ball to see through all of this stuff.

Let's start out with the contents of a simple XML file that holds AutoCAD Drawing Settings.  The file name of this file will be dwgset.xml
Code: [Select]

<? xml version="1.0"?>     <-- THIS LINE IS CRUCIAL!
<Settings>   <-- Top level parent object  -- only one per XML file.
  <Layers>
    <Layer Name="Walls" Color="2" LineType="continuous"/>
    <Layer Name="Furniture" Color="3" LineType="HIDDEN"/>
  </Layers>
  <DrawingVars>
    <RegenAuto>1</RegenAuto>
    <EdgeMode>0</EdgeMode>
    <Osmode>383</Osmode>
  </DrawingVars>
</Settings>


Now that we have our XML file...  Here are some code samples using the XML-API.vlx

Code: [Select]

(vl-load-com) ;; to make sure everything is peachy with Active-X
(load "xml-api.vlx") ;; load up the API

(setq oSettings (xml-Get-XMLObject "dwgset.xml")) ;; gets the settings element of the xml document object

(setq oLayers (xml-Get-Child oSettings nil "Layers")) ;; gets the Layers collection

(setq oRegen (xml-Get-Child oSettings "DrawingVars" "RegenAuto"))

;; to get the actual value of oRegen you can now use 'Text property as in
(vlax-get-property oRegen 'Text) ;; returns "1"
;; or you can get it this way...
(xml-Get-Child-Value oSettings "DrawingVars" "RegenAuto") ;; returns "1"

;; To  get a Layer object with specific attribute name
(xml-Get-Child-ByAttribute oSettings "Layers" "Name" "Walls")


I hope you guys/gals/robots/etc. get the picture.

Here are a couple of things to be aware of when dealing with XML and VLISP

1. Everything fetched from an XML file is a string.  You will have to post-process the info for type...  It is possible to define what type of data is entered using XML Schema.  But this API does not take that into account.

2. All text IS case sensitive when dealing with an XML file... the function names are not, but the data is.

I hope this can get y'all started.  If you have any specific questions, please ask...

Mark, I don't mind.  I put this out for all to enjoy.  So whatever helps the most...

SMadsen

  • Guest
External Data Storage with XML and VLISP
« Reply #24 on: January 07, 2004, 02:28:21 PM »
Columbia, is this version specific?
If so, which version does it use?

... oh, nevermind - just saw in your first post that it uses 3.0

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
External Data Storage with XML and VLISP
« Reply #25 on: January 07, 2004, 03:00:09 PM »
You can also import the msxml3.dll type library into Visual Lisp using:
Code: [Select]


(vlax-import-type-library
   :tlb-filename "C:/WINNT/System32/msxml3.dll"
   :methods-prefix "msxm-"
   :properties-prefix "msxp-"
   :constants-prefix "msxc-"
)


The :tlb-filename must point to the location of the file on your system

Then you can have all of the MS XML ActiveX components as well.

To see what they are, in the Visual Lisp editor open the Apropos window and type in the prefixes

msxm-   for methods
msxp-    for properties
msxc-    for constants

The syntax is the same as for the VBA counterparts
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

daron

  • Guest
External Data Storage with XML and VLISP
« Reply #26 on: January 07, 2004, 03:15:42 PM »
Windows XP pro it is:
Code: [Select]
(vlax-import-type-library
   :tlb-filename "C:/WINDOWS/System32/msxml3.dll"
   :methods-prefix "msxm-"
   :properties-prefix "msxp-"
   :constants-prefix "msxc-"
)


Is there a help file associated with these anywhere?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
External Data Storage with XML and VLISP
« Reply #27 on: January 07, 2004, 03:19:30 PM »
Unfortunately there is not a help file installed on the system for the this activex type library. Let me see if I can get anything from MS on this.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
External Data Storage with XML and VLISP
« Reply #28 on: January 07, 2004, 03:26:09 PM »
TheSwamp.org  (serving the CAD community since 2003)

SMadsen

  • Guest
External Data Storage with XML and VLISP
« Reply #29 on: January 07, 2004, 04:05:40 PM »
(vlax-create-object "MSXML.DOMDocument")
or
(vlax-create-object "MSXML2.DOMDocument.3.0")
or
(vlax-create-object "MSXML2.DOMDocument.4.0")

... are equally useful - depending on versions installed of course - if importing a type library is considered overkill.