diff --git a/docs/dom.rst b/docs/dom.rst index 3d8dd6f..2321ef1 100644 --- a/docs/dom.rst +++ b/docs/dom.rst @@ -109,14 +109,13 @@ This Byte_Sequence must always be encoded in the encoding defined in the package `Sax.Encoding` (as described earlier, changing this package requires recompiling XML/Ada). By default, this is UTF-8. -.. highlight:: ada - Therefore, if you need to set an attribute to a string encoded for instance in iso-8859-15, you should use the subprogram `Unicode.Encodings.Convert` to convert it appropriately. -The code would thus look as follows:: +The code would thus look as follows: - Set_Attribute (N, Convert ("å", From => Get_By_Name ("iso-8859-15"))); +.. literalinclude:: dom/convert.adb + :language: ada Printing DOM tress ================== diff --git a/docs/dom/convert.adb b/docs/dom/convert.adb new file mode 100644 index 0000000..33a8fd3 --- /dev/null +++ b/docs/dom/convert.adb @@ -0,0 +1 @@ +Set_Attribute (N, Convert ("å", From => Get_By_Name ("iso-8859-15")));