[plt-scheme] Help with redirecting ports

From: stig (tmcguire at world.std.com)
Date: Mon Nov 3 23:05:37 EST 2008

I am trying to read a content.xml from an openoffice .odt file. using
unzip-entry from the zip.plt library. Which works fine, I can pump the
output into ssax:xml->sxml but I can't seem to redirect the output to
a file my latest attempt (below) only dumps the sxml output onto the
screen in DrScheme. Any help would be much appreciated ( I commented
out the copy-port because it also wasn't doing what I wanted)

(require (planet "unzip.ss" ("dherman" "zip.plt" 2)))
(require (planet "sxml.ss" ("lizorkin" "sxml.plt" 2 0)))
(require (planet "ssax.ss" ("lizorkin" "ssax.plt" 2 0)))

(require (lib "port.ss"))

(define (odt2sxml filename)
  (unzip-entry
     filename
     (read-zip-directory filename )
      #"content.xml"
      (lambda (name dir in)
          (with-output-to-file "local-copy.sxml"
              (lambda ()
                (ssax:xml->sxml in (quote ()))
                ;(copy-port in (current-output-port) )
                ))))


Posted on the users mailing list.