3 Serialization
procedure
(srl:sxml->xml sxml-obj) → string?
sxml-obj : sxml? (srl:sxml->xml sxml-obj dest) → void? sxml-obj : sxml? dest : (or/c output-port? path-string?)
If dest is not supplied, the function returns a string that contains the serialized representation of the sxml-obj. If dest is supplied and is a port, the functions write the serialized representation of sxml-obj to this port. If dest is supplied and is a string, this string is treated as an output filename, the serialized representation of sxml-obj is written to that filename. If a file with the given name already exists, the effect is unspecified.
> (srl:sxml->xml '(zippy (pippy (@ (pigtails "2")) "ab") "bc")) "<zippy><pippy pigtails=\"2\">ab</pippy>bc</zippy>"
> (srl:sxml->xml '(zippy (pippy (@ (pigtails "2")) "ab") "bc") (current-output-port)) <zippy><pippy pigtails="2">ab</pippy>bc</zippy>
> (srl:sxml->xml (for/fold ([body '(nothing)]) ([i (in-range 5)]) `(doll (@ (level ,(number->string i))) ,body)) (current-output-port))
<doll level="4">
<doll level="3">
<doll level="2">
<doll level="1">
<doll level="0">
<nothing />
</doll>
</doll>
</doll>
</doll>
</doll>
procedure
(srl:sxml->xml-noindent sxml-obj) → string?
sxml-obj : sxml? (srl:sxml->xml-noindent sxml-obj dest) → void? sxml-obj : sxml? dest : (or/c output-port? path-string?)
> (srl:sxml->xml-noindent '(zippy (pippy (@ (pigtails "2")) "ab") "bc")) "<zippy><pippy pigtails=\"2\">ab</pippy>bc</zippy>"
> (srl:sxml->xml-noindent '(zippy (pippy (@ (pigtails "2")) "ab") "bc") (current-output-port)) <zippy><pippy pigtails="2">ab</pippy>bc</zippy>
> (srl:sxml->xml-noindent (for/fold ([body '(nothing)]) ([i (in-range 5)]) `(doll (@ (level ,(number->string i))) ,body)) (current-output-port)) <doll level="4"><doll level="3"><doll level="2"><doll level="1"><doll level="0"><nothing /></doll></doll></doll></doll></doll>
procedure
(srl:sxml->html sxml-obj) → string?
sxml-obj : sxml? (srl:sxml->html sxml-obj dest) → void? sxml-obj : sxml? dest : (or/c output-port? path-string?)
If dest is not supplied, the functions return a string that contains the serialized representation of the sxml-obj. If dest is supplied and is a port, the functions write the serialized representation of sxml-obj to this port. If dest is supplied and is a string, this string is treated as an output filename, the serialized representation of sxml-obj is written to that filename. If a file with the given name already exists, the effect is unspecified.
param
meta
link
isindex
input
img
hr
frame
col
br
basefont
base
area
Should this function automatically treat these differently? Yes, probably so.
procedure
(srl:sxml->html-noindent sxml-obj) → string?
sxml-obj : sxml? (srl:sxml->html-noindent sxml-obj dest) → void? sxml-obj : sxml? dest : (or/c output-port? path-string?)