Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power


#Servers
#Programminglanguages
 View Only
  • 1.  XML Encoding in native XML Scalar Functions

    Posted 03/15/23 04:08 PM

    Why do only 3 of the 5 XML reserved symbols get automagically encoded when using the XMLxxxxxx functions?

    & => & 
    < => &lt;
    > => &gt;

    These are converted as shown, however the apostrophe and the quote ("double quote") are not.



    ------------------------------
    Robert Cozzi
    ------------------------------

    #SQL


  • 2.  RE: XML Encoding in native XML Scalar Functions

    Posted 03/20/23 05:55 PM

    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
    ------------------------------



  • 3.  RE: XML Encoding in native XML Scalar Functions

    Posted 03/22/23 12:30 PM

    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 &quot; 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 &amp; &quot;the&quot; 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
    ------------------------------