Re: sxml:sxml->xml

"Dmitry Lizorkin" <[email protected]> Thu, 16 Oct 2003 11:08:27 +0400
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <001801c393b4$4c432110$3519a8c0@dima>
Mike, you are doing everything correctly. You should just add the function
call sxml:clean-feed at the end:

(sxml:clean-feed
   (sxml:sxml->xml '(*TOP*
                     (Person
                      (@ (id "1111"))
                      (FirstName "Homer")
                      (LastName "Simpson")
                      (EmptyElementHere)))))

This would produce a list of short strings:
> ("<" "*TOP*" ">" "<" "Person" " " "id" "='" "1111" "'" ">" "<" "FirstName"
">" "Homer" "</" "FirstName" ">" "<" "LastName" ">" "Simpson" "</"
"LastName" ">" "<" "EmptyElementHere" "/>" "</" "Person" ">" "</" "*TOP*"
">")

You may wish to display it:

(for-each
   display
   (sxml:clean-feed
    (sxml:sxml->xml '(*TOP*
                      (Person
                      (@ (id "1111"))
                      (FirstName "Homer")
                      (LastName "Simpson")
                      (EmptyElementHere))))))

or to combine it into a single string:

(apply
   string-append
   (sxml:clean-feed
    (sxml:sxml->xml '(*TOP*
                      (Person
                       (@ (id "1111"))
                       (FirstName "Homer")
                       (LastName "Simpson")
                       (EmptyElementHere))))))

You will get:
> "<*TOP*><Person
id='1111'><FirstName>Homer</FirstName><LastName>Simpson</LastName><EmptyElem
entHere/></Person></*TOP*>"

Dmitry




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php