Yes, I packaged the logic described by Jay into some utility functions in
my sugar/xml module to make it easier to read write an XML file with its
prolog:
http://pkg-build.racket-lang.org/doc/sugar/#%28part._.X.M.L%29
On Tue, Apr 21, 2015 at 7:25 AM, Nadeem Abdul Hamid nad...@acm.org wrote:
Was there ever a resolution to this question?
On Mon, Mar 30, 2015 at 2:12 PM, Matthew Butterick m...@mbtype.com wrote:
I understand that the preamble of an XML file (e.g., a first line like
?xml version=1.0 encoding=utf-8?) is not part of the X-expression
representing that file.
That's why in `response/xexpr`, there's an option for adding a preamble.
[1]
But with static XML files, I'm unclear about how preambles are supposed
to be handled. Use case: reading an XML file, modifying it, writing it back
out with the same preamble.
Reading: is the preamble just discarded? Am I supposed to grab it with
[small shiver] a regular expression?
;;;
#lang racket/base
(require xml)
(define x (string-xexpr ?xml version=\1.0\
encoding=\utf-8\?roothello world/root))
x
'(root () hello world)
;;;
Writing: functions like `xexpr-xml` and `xexpr-string` of course take
an Xexpr without a preamble. Again, is the intention that it be added
manually (e.g. with `string-append`)?
[1]
http://docs.racket-lang.org/web-server/http.html?q=response%2Fxexpr#%28def._%28%28lib._web-server%2Fhttp%2Fxexpr..rkt%29._response%2Fxexpr%29%29
--
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.
--
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.