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

0 Members and 1 Guest are viewing this topic.

MiD-AwE

  • Mosquito
  • Posts: 2
Re: External Data Storage with XML and VLISP
« Reply #60 on: December 31, 2013, 02:12:38 PM »
I am one of those folk that believes in reviving old threads instead of starting anew. I hope no one rips me a new one for my belief  :ugly: (BTW-this is my first post.)

I'm trying to use the XML-API.lsp but I'm struggling with one thing. I need a way to create the xml file as I need it, instead having to build a massive xml file with all possible options before hand.

Am I the only one thinking this way and if so is it a bad idea? Will the xml-api flop if the file is not pre-existing?

I would like a function that I can use inline like (XML-Set-Child PARENTNAME NEWCHILDNAME VALUE) & similar for new parent and so on.

Thank you in advance.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: External Data Storage with XML and VLISP
« Reply #61 on: December 31, 2013, 02:34:51 PM »
I am one of those folk that believes in reviving old threads instead of starting anew.
You picked a good one too. :) I had forgotten all about this thread.
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: External Data Storage with XML and VLISP
« Reply #62 on: December 31, 2013, 03:10:38 PM »
Welcome to the Swamp MiD-AwE
Make sure you check out the XML threads http://goo.gl/53wuPW
« Last Edit: December 31, 2013, 03:13:51 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MiD-AwE

  • Mosquito
  • Posts: 2
Re: External Data Storage with XML and VLISP
« Reply #63 on: January 02, 2014, 10:02:52 AM »
Welcome to the Swamp MiD-AwE
Make sure you check out the XML threads http://goo.gl/53wuPW

Thank you for the greetings. I'll read through the results, hopefully I'll find something useful.  :|
« Last Edit: January 02, 2014, 10:20:29 AM by MiD-AwE »

eddybeerke

  • Mosquito
  • Posts: 2
Re: External Data Storage with XML and VLISP
« Reply #64 on: March 29, 2024, 08:26:22 AM »
I need to read a XML file and ren in to this post.
I didnt get the api-xml to work properly, so i made this:

XML-File (ofc the original file is a lot bigger, like 2.339 kB  :idiot2:)
Code: [Select]
<?xml version="1.0" encoding="ISO-8859-1"?>
<objects>
<Object nummer="1" hoofdgroep="2" omschrijving="AANKLEDING" />

lisp-file
Code: [Select]
(defun c:foo ( / oXML childNodes item attribute attribute_name nummer)
  ;; Load the VisualLISP stuff
  (vl-load-com)
 
  (setq oXML (XML-get-XMLObject "C:/TEST_READ_XML/objects.xml"))
  ; lees de childNodes
  (setq childNodes (vlax-get-property oXML "childNodes")) 
  (vlax-for item childNodes
    ;(vlax-dump-object item)
    ; lees attributes
    (vlax-for attribute (vlax-get-property item 'attributes)
      (cond
        ((= (setq attribute_name (vlax-get-property attribute 'basename)) "nummer")       (setq nummer         (vlax-get-property attribute 'text)))
        ((= (setq attribute_name (vlax-get-property attribute 'basename)) "omschrijving") (setq omschrijving   (vlax-get-property attribute 'text)))
      )
    )
    (princ (strcat"\n" nummer " | " omschrijving "\n"))
  )
  ;; release the objects
  (vlax-release-object oXML)
 
  (princ)
)

Hoping to help someone.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: External Data Storage with XML and VLISP
« Reply #65 on: March 29, 2024, 12:56:40 PM »
You might find this thread useful:
https://www.theswamp.org/index.php?topic=33065.0