didi you try to do the opposite ?
Did you try to parse a fragment of xml containing a comment to see what the resulting sxml is ?
Yeah. Using a comment alone:
(xml->sxml "<!-- text -->")
gives me an "Unexpected EOF" error.
However, using a comment with proper HTML tags:
(xml->sxml
"<!DOCTYPE html>\
<html>\
<body>\
<!-- text -->\
</body> </html>")
Will output the tree:
(*TOP* (html (body)))
It looks like Guile sees the comment, but removes it from the tree.
Some SXML implementations use the token *COMMENT*, so at least I have some code to read. I just don't want to use an external module for something so seemingly simple.
I scanned the source (http://git.savannah.gnu.org/cgit/guile.git/tree/module/sxml/simple.scm) and didn't see any specific token for comments so you'll have to do some major mods to get it in there.
You could probably expand the default element handler but it'll take some work.
@MutoShack I also checked the w3c standard (yeah...went off the deep end here) and it states "an XML processor MAY, but need not, make it possible for an application to retrieve the text of comments".
I guess they embraced the 'MAY' here :)
@drewfer
Thanks, again.
It's a popular choice. I found quite a few SXML implementations that decide to take the "ignore comments" route, and honestly, I don't blame them. I don't know why the standard isn't something like:
<comment>
text
</comment>
which would mean processors wouldn't have to do *extra* work to deal with them!