2012-11-12 2 views
0

url-retrieve-synchronously 함수를 사용하고 응답을 포함하는 버퍼를 반환합니다. 응답의 본문을 가져 와서 xml-parse-region에 전달할 수있는 비 해킹 방법이 있는지 궁금합니다.emacs의 url에서 xml을 어떻게 파싱합니까?

xml-parse-from-url 함수가 있습니까? url-retrieve에서 응답을 어떻게 파싱합니까?

답변

0

및 반환 구문 분석 응답 :

(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))))) 
0

이맥스와 함께 배포 된 패키지 중 일부가 어떻게 사용되는지 살펴볼 수 있습니다. 예 : lisp/net/newst-backend.ellisp/net/soap-client.el.

합니다 (GNU GPL 버전 2에 따라 사용이 허가)이 Identica-mode.el URL이-검색하고 XML 파서에 건네 사용하는 함수가 거기에서
+0

당신이 붙여 넣을 수 일부 코드? 나는 자기 자신의 로컬 설치에서 이맥스를 발견 할 수 없었다. 나는'find-grep'의'url-retrieve'를 사용하려고 시도했다. –

관련 문제