;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require cl-lib xml pcase] 2) #@120 A simple function, strips the whitespace from beginning and end of the string. Leaves all other whitespace untouched. (defalias 'string-trim-whitespace #[(string) "\301\302\303#\207" [string replace-regexp-in-string "\\`[[:space:]]*\\([^z-a]+?\\)[[:space:]]*\\'" "\\1"] 4 (#$ . 171)]) #@113 This may cause problems, is intended for parsing xml into sxml but may eroneously delete desirable white space. (defalias 'esxml-trim-ws #[(esxml) ";\203 \306!\207\242\243\211\242\n\243 \f \211\n \307\310 \".BB\207" [esxml #1=#:x0 #2=#:x1 #3=#:x2 #4=#:x3 body string-trim-whitespace mapcar esxml-trim-ws attrs tag] 6 (#$ . 465)]) #@103 Returns t if attr is a an esxml attribute. An esxml attribute is a cons of the form (symbol . string) (defalias 'attrp #[(attr) ":\205@9\205A;\207" [attr] 1 (#$ . 817)]) #@75 Converts from cons cell to attribute pair. Not intended for general use. (defalias 'esxml--convert-pair #[(attr) "\242\243 \n ;\204\305\306\307 \303E\"\210\310\f!\311\312 !Q,\207" [attr #1=#:x4 #2=#:x5 cdr car signal wrong-type-argument string symbol-name "=" prin1-to-string] 5 (#$ . 1000)]) #@65 Returns t if attrs is a list of esxml attributes. See: `attrp' (defalias 'attrsp #[(attrs) "<\205 \301\302\"\207" [attrs cl-every #[(attr) ":\205@9\205A;\207" [attr] 1]] 3 (#$ . 1308)]) #@99 A fast esxml validator. Will error on invalid subparts making it suitable for hindsight testing. (defalias 'esxml-validate-form #[(esxml) ";\203\306\207G\307W\203\310\311\"\207\242\243\211\242\n\243 \f\211 9\2045\312\313\314 \315E\"\210\316!\204E\312\313\317\317E\"\210\320\321 \".\207" [esxml #1=#:x6 #2=#:x7 #3=#:x8 #4=#:x9 body nil 2 error "%s is too short to be a valid esxml expression" signal wrong-type-argument symbol tag attrsp attrs mapcar esxml-validate-form] 6 (#$ . 1511)]) (defalias 'esxml--to-xml-recursive #[(esxml) "\306 ;\203 \202\210 :\205\210 \242\211\307=\203k \243\211:\205g \242\211\204[ \243\211:\203R \242\n \243\211 \204I\n\f\310\f\311Q)\202N\n\f #*\202W\n\f #)\202f \243 \n\f #)))\202\207 \243\211:\205\206\242\243\n#*)))\207" [#1=#:pcase-0 esxml #2=#:x10 #3=#:x11 #4=#:x12 #5=#:x13 #[(tag attrs body) "\303\304! \205\305\306\307 \305#P\n\203#\310\306\311\n\312#\313\304!\310\260\202$\314R\207" [tag attrs body "<" symbol-name " " mapconcat esxml--convert-pair ">" esxml--to-xml-recursive "" ""] 8] comment "" #6=#:x14 #7=#:x15 body #8=#:x16 #9=#:x17 #10=#:x18 #11=#:x19] 5]) #@962 This translates an esxml expression, i.e. that which is returned by xml-parse-region. The structure is defined as a string or a list where the first element is the tag the second is an alist of attribute value pairs and the remainder of the list is 0 or more esxml elements. (TAG ATTRS &rest BODY) || STRING TAG: is the tag and must be a symbol. ATTRS: is an alist of attribute pairs each pair must be of the form (KEY . VALUE). KEY: is the name of the attribute and must be a symbol. VALUE: is the value of the attribute and must be a string. BODY: is zero or more esxml expressions. Having no body forms implies that the tag should be self closed. If there is one or more body forms the tag will always be explicitly closed, even if they are the empty string. STRING: if the esxml expression is a string it is returned unchanged, this allows for caching of any constant parts, such as headers and footers.  (defalias 'esxml-to-xml #[(esxml) "\3011 \302!0\207\210\303!\207" [esxml (error) esxml--to-xml-recursive esxml-validate-form] 2 (#$ . 2716)]) #@158 This translates an esxml expresion as `esxml-to-xml' but indents it for ease of human readability, it is neccesarrily slower and will produce longer output. (defalias 'pp-esxml-to-xml #[(esxml) "\306 ;\203 \202\235 :\203\231 \242\211\307=\203r \243\211:\203j \242\211\204[ \243\211:\203R \242\f \243\211 \204I\f\310\311Q)\202N\n\f #*\202W\n\f #)\202f \243\n\f#))\202n\312\313 \")\202\225 \243\211:\203\220\242\243\n#*\202\224\312\313 \"))\202\235\312\313 \")\207" [#1=#:pcase-0 esxml #2=#:x20 #3=#:x21 #4=#:x22 #5=#:x23 #[(tag attrs body) "9\204 \303\304\305\300E\"\210\306 !\204\303\304\301 \301E\"\210\307\310! \205*\311\312\313 \311#P\n\203T\314\315\316\n\"\203>\312\317\n\311#\202J\320\321\322\323\312\324\n\320##\320Q\325\310!\314\260\202U\326R\207" [tag attrs body signal wrong-type-argument symbol attrsp "<" symbol-name " " mapconcat esxml--convert-pair ">" cl-every stringp identity "\n" replace-regexp-in-string "^" " " pp-esxml-to-xml ""] 12] comment "" error "%s is not a valid esxml expression" #6=#:x24 #7=#:x25 body #8=#:x26 #9=#:x27 #10=#:x28 #11=#:x29] 5 (#$ . 3829)]) #@106 Translates sxml to esxml so the common standard can be used. See: http://okmij.org/ftp/Scheme/SXML.html. (defalias 'sxml-to-esxml #[(sxml) "\306 :\203_ \242 \243\211:\203W \242\211:\203O\f\242\211\307=\203G\f\243 \243\f\n \f \211\310\311\"\310\312 \"-BB\202K\n \")\202S\n \")\202[\n \"*\202e ;\205e )\207" [#1=#:pcase-0 sxml #2=#:x30 #3=#:x31 #4=#:x32 #5=#:x33 #[(tag body) "\302\303\304 \"BB\207" [tag body nil mapcar sxml-to-esxml] 5] @ mapcar #[(attr) "@A@\206\f\301@!B\207" [attr prin1-to-string] 3] sxml-to-esxml #6=#:x34 #7=#:x35 body attrs tag] 6 (#$ . 5004)]) #@72 Translates sxml to xml, via esxml, hey it's only a constant factor. :) (defalias 'sxml-to-xml #[(sxml) "\301\302!!\207" [sxml esxml-to-xml sxml-to-esxml] 3 (#$ . 5613)]) (defalias 'xml-to-esxml #[(string &optional trim) "\304\305\306\"rq\210\307\216 c\210\310ed\" \203\311\n!\202\n,\207" [#1=#:temp-buffer string parse-tree trim generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] libxml-parse-xml-region esxml-trim-ws] 3]) #@152 Returns a list of all elements whose wttribute KEY match VALUE. KEY should be a symbol, and VALUE should be a string. Will not recurse below a match. (defalias 'esxml-get-by-key #[(esxml key value) ";?\2054\242\243\211\242\n\243 \f \f \306 \"\232\203+C\2022\307\310\311\312 \"\".\207" [esxml #1=#:x36 #2=#:x37 #3=#:x38 #4=#:x39 body assoc-default apply append mapcar #[(sexp) "\303 \n#\207" [sexp key value esxml-get-by-key] 4] attrs tag value key] 6 (#$ . 6096)]) #@148 Returns a list of all elements whose tag is a member of TAGS. TAGS should be a list of tags to be matched against. Will not recurse below a match. (defalias 'esxml-get-tags #[(esxml tags) ";?\205/\242\243\211\242\n\243 \f\n\211 \f\235\203&C\202-\306\307\310\311 \"\".\207" [esxml #1=#:x40 #2=#:x41 #3=#:x42 #4=#:x43 body apply append mapcar #[(sexp) "\302 \"\207" [sexp tags esxml-get-tags] 3] attrs tag tags] 6 (#$ . 6590)]) #@30 Returns a list of all forms. (defalias 'esxml-get-forms #[(esxml) "\301\302\"\207" [esxml esxml-get-tags (form)] 3 (#$ . 7040)]) (defalias 'esxml-destructuring-mapcar '(macro . #[(args sexp seq) "\304\305!\306\307C\310 \nFE E)\207" [entry args sexp seq make-symbol "entry" mapcar lambda cl-destructuring-bind] 7])) (byte-code "\300\301\302\303#\304\305!\207" [function-put esxml-destructuring-mapcar lisp-indent-function 2 provide esxml] 4)