Thanks for the reference. Yes it does say "may be..." for the quote and apostrophe. I just checked the XMLATTRIBUTES function and it does encode quotes with " when one is in the data, but continues to round-trip the apostrophe.
select xmlelement(NAME "ChatBot", xmlattributes('Harry Potter & "the" Philosopher''s Stone' as "title"))
from sysibm.sysdummy1
Which outputs:
<ChatBot title="Harry Potter & "the" Philosopher's Stone"/>
So it looks like it'll do the right thing in the right context. I just hope whatever parser the other guys are using accommodates this.
Thanks again for the tip.
------------------------------
Robert Cozzi
------------------------------
Original Message:
Sent: Mon March 20, 2023 05:55 PM
From: Kent Milligan
Subject: XML Encoding in native XML Scalar Functions
Talked to some of the developers and this working as designed.
Not documented in the SQL Reference because it's documented in the XML Standard. The Character Data and Markup section describes how apostrophe and the quote "may be" encoded - it's not a requirement like the other special characters.
------------------------------
Kent Milligan
------------------------------