Created
April 1, 2015 15:33
-
-
Save xuchunyang/d50db432fb31bee98485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; elisp-parse-xml.el --- demo for parse xml in Emacs Lisp | |
;;; Created: 2015/04/01 | |
;;; URL: $gist_url$ | |
(insert-file-contents "~/ss.xml") | |
;; ==> | |
;; <?xml version="1.0" encoding="UTF-8"?> | |
;; <note> | |
;; <to>Tove</to> | |
;; <from>Jani</from> | |
;; <heading>Reminder</heading> | |
;; <body>Don't forget me this weekend!</body> | |
;; </note> | |
(let* ((a (xml-parse-file "~/ss.xml")) | |
(b (car a)) | |
(c (xml-node-children b))) | |
(dolist (p c) | |
(when (listp p) | |
(insert (concat "\n" | |
(symbol-name (car p)) | |
" = " | |
(car (cdr (cdr p)))))))) | |
;; ==> | |
;; to = Tove | |
;; from = Jani | |
;; heading = Reminder | |
;; body = Don't forget me this weekend | |
;;; elisp-parse-xml.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment