如何从emacs中的url解析xml?

如何从emacs中的url解析xml?,xml,url,emacs,Xml,Url,Emacs,我正在使用url同步检索函数,它返回一个包含响应的缓冲区。我想知道是否有一种非黑客的方式来获取响应的主体并将其传递给xml解析区域 是否有从url解析xml的函数?如何解析url检索的响应 您可以看看使用Emacs分发的一些包是如何做到这一点的。例如,lisp/net/newst backend.el和lisp/net/soap client.el在identica-mode.el(根据GNU GPL版本2授权)中,有一个函数将使用url检索并将其传递给xml解析器,并返回解析后的响应: (de

我正在使用url同步检索函数,它返回一个包含响应的缓冲区。我想知道是否有一种非黑客的方式来获取响应的主体并将其传递给xml解析区域


是否有从url解析xml的函数?如何解析url检索的响应

您可以看看使用Emacs分发的一些包是如何做到这一点的。例如,
lisp/net/newst backend.el
lisp/net/soap client.el

在identica-mode.el(根据GNU GPL版本2授权)中,有一个函数将使用url检索并将其传递给xml解析器,并返回解析后的响应:

(defun identica-get-response-body (&optional buffer)
  "Extract HTTP response body from HTTP response, parse it as XML, and return a XML tree as list.
`buffer' may be a buffer or the name of an existing buffer.
 If `buffer' is omitted, current-buffer is parsed.

Removed the call to `identica-clean-response-body'."
  (or buffer
      (setq buffer (current-buffer)))
  (set-buffer buffer)
  (set-buffer-multibyte t)
  (let ((start (save-excursion
         (goto-char (point-min))
         (and (re-search-forward "<\?xml" (point-max) t)
              (match-beginning 0)))))
    ;;(identica-clean-response-body) ; necessary for identica, cleaned up some weird characters
    (and start
         (xml-parse-region start (point-max)))))
(defun identica get响应体(&可选缓冲区)
从HTTP响应中提取HTTP响应体,将其解析为XML,并返回XML树作为列表。
`“缓冲区”可以是缓冲区或现有缓冲区的名称。
如果省略“buffer”,则分析当前缓冲区。
已删除对“identica clean response body”的调用。“
(或缓冲器)
(setq缓冲区(当前缓冲区)))
(设置缓冲区)
(设置缓冲区多字节t)
(让()开始(保存行程
(转到字符(最小点))

(和)(向前搜索)“你能粘贴一些代码吗?我在自己本地安装的emacs中似乎找不到,我甚至尝试
查找grep
使用
url检索