At 2018-05-14T00:33:45-04:00, John Clements wrote:

> It turns out that the “sxml:document” function looks for local files
> *without* a file: prefix. So, you can just call
>
> (sxml:docmuent “/tmp/test.xml”)

Thanks for your help.  The above is not working for me:

----------
> (sxml:document "/tmp/test.xml")
open-input-resource: /tmp/test.xml: Missing protocol (usually "http:") at the 
beginning of URL: /tmp/test.xml
peek-char: contract violation
  expected: input-port?
  given: #f
  context...:
   /home/raghu/.racket/6.12/pkgs/sxml/sxml/ssax/input-parse.rkt:94:0: skip-while
   /home/raghu/.racket/6.12/pkgs/sxml/sxml/ssax/SSAX-code.rkt:1150:0: 
ssax:scan-Misc
   /home/raghu/.racket/6.12/pkgs/sxml/sxml/ssax/SSAX-code.rkt:1657:5: 
scan-for-significant-prolog-token-1
   /home/raghu/.racket/6.12/pkgs/sxml/sxml/ssax/SSAX-code.rkt:1879:0: 
ssax:xml->sxml
   /home/raghu/.racket/6.12/pkgs/sxml/sxml/xpath-context_xlink.rkt:2752:0: 
sxml:document
   /usr/share/racket/collects/racket/private/misc.rkt:88:7
>
----------

> I usually just use "ssax:xml->sxml” instead, which will also work for
> you.

Yes, it does:

----------
> (call-with-input-file "/tmp/test.xml"
    (lambda (in)
      (ssax:xml->sxml in '())))

'(*TOP*
  (*PI* xml "version=\"1.0\" encoding=\"utf-8\"")
  (http://www.w3.org/1999/xhtml:html ...
>
----------

Raghu.

--
N. Raghavendra <ra...@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to