using xml

Started by Dmi, December 16, 2005, 02:07:54 PM

Previous topic - Next topic

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.
WBR, Dmi

Lutz

#1
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

Lutz

#2
... 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

Dmi

#3
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:
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:
((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?
WBR, Dmi