using xml

For the Compleat Fan
Locked
Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

using xml

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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post 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?
WBR, Dmi

Locked