Page 1 of 1

using xml

Posted: Fri Dec 16, 2005 10:07 pm
by Dmi
Does anybody have a nice tricks for converting xml data into a traditional list structure?

xml-parse does the one-to-one conversion of symbolic xml structure to a list.
But I need to extract some particular data from xml into simple nested list structure, that can be easily processed with newlisp. And to skip all other unwanted tags and data.

Posted: Fri Dec 16, 2005 10:14 pm
by Lutz
There is a function called 'xml-type-tags' used to customize the output. If you put all tags to 'nil' you get streight Lisp expressions with no XML type tags. Or you can modify tags to your needs.

Its all in the manual.

Lutz

Posted: Fri Dec 16, 2005 10:24 pm
by Lutz
... in case you investigated those possibilities already and it did not help you, perhaps you can give us an example how you want to translate something.

Lutz

Posted: Sat Dec 17, 2005 11:06 am
by Dmi
Yes, I know about xml-type-tags :-)
I have a hardly structured data, say the xml output from "xlhtml" convertor.
The structure is about that:

Code: Select all

 excel_workbook
   sheets
     author
     issuing-date
     other-key-fields
     sheet
       sheet-name
       a-bunch-of-unwanted-keys
       row
        keys-with-style-info
        cell
          keys-with-style-info
          rownum
          colnum
          something...
          cell-data
There also are some other intermediate levels of nesting.

Generally, I want to quick-parse this structure to extract only theese info:

Code: Select all

((sheet1-name
  ((cell-data-for-row-1 cell-data-for-row-1....)
   (cell-data-for-row-2 ....)))
 (sheet2-name
  ((cell-data-for-row-2 ...))))
I.e., I want to extract data and nesting only about some keys and skip other info.

I can see a way to imlement some traditional possibilities (say, hook-based parsing), but, possible anyone done it already?