All pastes #343728 Raw Edit

Emacs XML RPC

public text v1 · immutable
·published 2007-02-07 06:52 UTC
rendered paste body
(require 'url)
(require 'xml-rpc)

(require 'mailheader)

(defun remove-trailing-cr (&optional buffer)
  (let ((carriage-return (with-temp-buffer (insert 13) (buffer-string))))
    (with-current-buffer (if buffer buffer (current-buffer))
      (save-excursion
	(goto-char (point-min))
	(while (search-forward carriage-return nil t)
	  (replace-match "" nil t))))))

(setf (symbol-function 'xml-parse-region)
      (eval
	`(lambda (BEG END &optional BUFFER PARSE-DTD)
	  (remove-trailing-cr BUFFER)
	  (funcall ,(symbol-function 'xml-parse-region) BEG END BUFFER PARSE-DTD))))

(xml-rpc-method-call "http://time.xmlrpc.com/RPC2"
		     'currentTime.getCurrentTime)