OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: nwgeo on October 15, 2007, 04:55:24 PM

Title: Reading XML files?
Post by: nwgeo on October 15, 2007, 04:55:24 PM
I might have posted this with the last question, but it is an entirely different subject, so I thought I'd better post this by itself.  My interest in dialog box code is two-fold.

1) There is quite a bit of VB-esque looking functionality now with this DLL and it is a far cry better than the old "yellow" looking, clunky diabox code of yester year.

2) I would like to be able to take the contents of an XML file and display the results of a user query in a listbox.

Has anyone come across a suitable way to read XML files from a LISP interpreter?  I'm looking to read around 7,500 rows of address records into memory, have the user type in an address number, then display the results in a listbox [e.g. all addresses that match the house number entered in a text box].

I could read an XML file exported from Access [preferred] or go the old-fashoned way and kludge together a LISP-type list like this:

(setq addrls (list
  ("123" (
    ("123 MAIN STREET")
    ("123 44TH AVE NE")
    ("123 91ST PLACE")
  ))
   ...... [and so on for all unique address numbers]
)));end SETQ addrls

Sorry for all of the detail, but I thought I'd better err on the side of "too much information" rather saying, "Hey, I need help...."

TIA for any ideas or for pointing me to another resource.  Can't wait to get coding with this library!
Title: Re: Reading XML files?
Post by: BazzaCAD on October 15, 2007, 08:16:12 PM
Have a look here: http://www.theswamp.org/index.php?topic=541.0
Title: Re: Reading XML files?
Post by: Kerry on October 16, 2007, 03:18:44 AM
nwgeo,

I can't post my XML library, unfortunately , (well not the source anyway   ;) )
.. but I'll give you an option ...
If you are doing a lot of manipulation of datasets perhaps have a look at ADOLISP by Jon  Fleming.
His Library is at http://acad.fleming-group.com/index.html
Look for ADOLISP Database Library

You can then use conventional SQL style queries which may speed up your searching .. and you'll have the advantage of not needing to convert your Access BD, just use it as is.


edit: <kwb> fixed fat finger spelling

 
Title: Re: Reading XML files?
Post by: nwgeo on October 16, 2007, 08:25:46 AM
Thanks Kerry,

I'll check it out.  This has been a challenge for me, trying to stay AWAY from the MDAC and other database driver related issues.  I just cringe everytime there is a service pack release or a version of Access changes becuase I know I'm going to be getting the phone calls.  If I can connect directly to an Access query, that would save the intermediate step of exporting an XML formatted file.  Thanks for the link and info.

Still, I'll be watching out for any XML-related posts as this seems to be the format of choice for information [graphic and non-graphic] for interchange between applications.  It just makes sense to be ready with an AutoCAD-based solution as well.

[Update]: I did follow ths link and found out that it does rely on the existance of "msado15.dll"  The LISP code explicitly goes searching around on the host machine:

            (findfile
              (if (getenv "systemdrive")
                (strcat
                  (getenv "systemdrive")
                  "\\program files\\common files\\system\\ado\\msado15.dll"
                )
                "c:\\program files\\common files\\system\\ado\\msado15.dll"
              )


Perhaps there is just no getting around this :(