[plt-scheme] make-custom-input-port missing?

From: Doug Orleans (dougorleans at gmail.com)
Date: Mon Apr 17 14:21:37 EDT 2006

Paulo J. Matos writes:
 > Hi all,
 > 
 > Why parsing a XML file took from the net with the line (using net/url
 > collection):
 > (xml->xexpr (document-element (read-xml (get-pure-port (string->url
 > server-list-url))))))
 > 
 > The following is returned:
 > (Data
 >   ()
 >   "\r\n\t"
 >   (FileName () "menu.asp")
 >   "\r\n\t"
 >   (Version () "1.1")
 >   "\r\n\t"
 > ...)
 > 
 > I don't like the "\r\n\t"... I went to net docs:
 > read-xml : [Input-port] -> Document
 >         (...)
 > Any non-characters other than eof read from the input-port will
 >        appear in the document content.  Such special values may only appear
 >        where XML content may.  See make-custom-input-port for information
 >        about creating ports that return non-character values.

You may not like "\r\n\t", but they are not `non-characters', so this
is probably not what you want.  You probably want to look at
`eliminate-whitespace' (in the XML collection), and then realize that
it sucks and write your own version.  (E.g. Hans Oesterholt-Dijkema
suggested removing whitespace strings from all non-leaf nodes.  Maybe
this is easy with SXSLT?)

--dougorleans at gmail.com


Posted on the users mailing list.