diff options
| author | Ulf Jasper | 2009-12-06 18:13:19 +0000 |
|---|---|---|
| committer | Ulf Jasper | 2009-12-06 18:13:19 +0000 |
| commit | 571855b6310390faa67d00bef0b0bc7aa118348f (patch) | |
| tree | 4d21b17a290bb167d03fdd829927730e5e078053 /lisp/xml.el | |
| parent | b857059c0aaae85bff9c897b97dcba532e93e40a (diff) | |
| download | emacs-571855b6310390faa67d00bef0b0bc7aa118348f.tar.gz emacs-571855b6310390faa67d00bef0b0bc7aa118348f.zip | |
Fixed Bug#5008.
Diffstat (limited to 'lisp/xml.el')
| -rw-r--r-- | lisp/xml.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/xml.el b/lisp/xml.el index e86232d5718..ac96286fdec 100644 --- a/lisp/xml.el +++ b/lisp/xml.el | |||
| @@ -823,6 +823,25 @@ This follows the rule [28] in the XML specifications." | |||
| 823 | "") | 823 | "") |
| 824 | (substring string point)))))) | 824 | (substring string point)))))) |
| 825 | 825 | ||
| 826 | (defun xml-substitute-numeric-entities (string) | ||
| 827 | "Substitute SGML numeric entities by their respective utf characters. | ||
| 828 | This function replaces numeric entities in the input STRING and | ||
| 829 | returns the modified string. For example \"*\" gets replaced | ||
| 830 | by \"*\"." | ||
| 831 | (if (and string (stringp string)) | ||
| 832 | (let ((start 0)) | ||
| 833 | (while (string-match "&#\\([0-9]+\\);" string start) | ||
| 834 | (condition-case nil | ||
| 835 | (setq string (replace-match | ||
| 836 | (string (read (substring string | ||
| 837 | (match-beginning 1) | ||
| 838 | (match-end 1)))) | ||
| 839 | nil nil string)) | ||
| 840 | (error nil)) | ||
| 841 | (setq start (1+ (match-beginning 0)))) | ||
| 842 | string) | ||
| 843 | nil)) | ||
| 844 | |||
| 826 | ;;******************************************************************* | 845 | ;;******************************************************************* |
| 827 | ;;** | 846 | ;;** |
| 828 | ;;** Printing a tree. | 847 | ;;** Printing a tree. |