# Sxml serialization of non-XML-compatible identifiers

**URL:** <https://racket.discourse.group/t/sxml-serialization-of-non-xml-compatible-identifiers/1751>\
**Category:** General\
**Created:** [March 3, 2023, 5:51am UTC](https://racket.discourse.group/t/sxml-serialization-of-non-xml-compatible-identifiers/1751 "2023-03-03T05:51:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [March 3, 2023, 5:51am UTC](https://racket.discourse.group/t/sxml-serialization-of-non-xml-compatible-identifiers/1751/1 "2023-03-03T05:51:18Z")

</div>

In

> <https://github.com/jbclements/sxml/issues/12>
>
> Symbol to string conversion in \`srl:sxml-\>xml\` does not escape XML characters. N…or does string parsing in \`ssax:xml-\>sxml\` recognise escaped characters.
> 
> \`\`\`
> (require sxml) 
> (srl:sxml-\>xml '(number-\>string "2")) ;; '\>' not escaped...
> (ssax:xml-\>sxml (open-input-string (srl:sxml-\>xml '(number-\>string "2"))) null) ;; ... so this fails
> (ssax:xml-\>sxml (open-input-string "\<number-&gt;string\>2\</number-&gt;string\>") null) ;; but this also fails
> \`\`\`

t0mpr1c3 points out that `srl:sxml->xml` does not appear to perform any validation to ensure that the tag names used conform to legal xml names (IIUC, this is the "NCName" production in the W3C's XML recommendation:

[https://www.w3.org/TR/REC-xml/#NT-Name](https://www.w3.org/TR/REC-xml/#NT-Name)

Generally speaking, this seems like the kind of thing that Oleg et al. get right, so I'm hesitant to call this a bug without digging a little deeper. Anyone know if there's a good reason why srl doesn't perform this validation? (I've also written to Oleg, though I'm not sure I still have a good email address for him.)
