Re: XML parsing bug?

Oleg Parashchenko <olpa-1YK4M1/[email protected]> Mon, 29 Aug 2011 13:40:30 +0200
Newsgroups gmane.lisp.scheme.ssax-sxml
Organization private person
Message-ID <[email protected]>
Hello Oleg,

thank you for the explanation.

On Fri, 26 Aug 2011 20:18:58 -0700 (PDT)
[email protected] wrote:

...
> 
> So, you my wish to re-define ssax:xml->sxml in your project to call
> ssax:reverse-collect-str function. Or, add the definition
> 
> (define ssax:reverse-collect-str-drop-ws ssax:reverse-collect-str)

As space elimination is often a good thing, I decided to implement a
conditional approach.

In a private copy of code, I changed

(let ((seed (ssax:reverse-collect-str-drop-ws seed))

to

(let ((seed ((if (tag-drops-xml-space? elem-gi)
  ssax:reverse-collect-str-drop-ws ssax:reverse-collect-str) seed))

where "tag-drops-xml-space?" is something like

(define tag-drops-xml-space?
  (let ((drop-list (map add-my-ns (list "chapter" "subchapter" ...))))
    (lambda (elem-gi) (let ((full-gi (if (pair? elem-gi)
                        (string->symbol (string-append
                                        (symbol->string (car elem-gi)) ":"
                                        (symbol->string (cdr elem-gi))))
                         elem-gi)))
        (memq full-gi drop-list)))))

...
> 
> To recap: the observed behavior is intentional. There is a way to
> change it.
> 
> 	Cheers,
> 	Oleg

-- 
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  XML, TeX, Python, Mac, Chess


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev