Convert an XML entity to Unicode value. Return -1 on error; */
| 1913 | Return -1 on error; |
| 1914 | */ |
| 1915 | static int |
| 1916 | my_xml_entity_to_char(const char *name, uint length) |
| 1917 | { |
| 1918 | if (length == 2) |
| 1919 | { |
| 1920 | if (!memcmp(name, "gt", length)) |
| 1921 | return '>'; |
| 1922 | if (!memcmp(name, "lt", length)) |
| 1923 | return '<'; |
| 1924 | } |
| 1925 | else if (length == 3) |
| 1926 | { |
| 1927 | if (!memcmp(name, "amp", length)) |
| 1928 | return '&'; |
| 1929 | } |
| 1930 | else if (length == 4) |
| 1931 | { |
| 1932 | if (!memcmp(name, "quot", length)) |
| 1933 | return '"'; |
| 1934 | if (!memcmp(name, "apos", length)) |
| 1935 | return '\''; |
| 1936 | } |
| 1937 | return -1; |
| 1938 | } |
| 1939 | |
| 1940 | |
| 1941 | /** |