;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:21:18 2007 ;;; from file /home/cyd/emacs/lisp/xml.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`xml.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #@43 What to substitute for undefined entities (defconst xml-undefined-entity "?" (#$ . 553)) #@75 The defined entities. Entities are added to this when the DTD is parsed. (defvar xml-entity-alist '(("lt" . "<") ("gt" . ">") ("apos" . "'") ("quot" . "\"") ("amp" . "&")) (#$ . 648)) #@79 Dynamically set this to a non-nil value if you want to parse an XML fragment. (defvar xml-sub-parser nil (#$ . 839)) #@42 Set to non-nil to get validity checking. (defvar xml-validating-parser nil (#$ . 962)) #@293 Return the tag associated with NODE. Without namespace-aware parsing, the tag is a symbol. With namespace-aware parsing, the tag is a cons of a string representing the uri of the namespace with the local name of the tag. For example, would be represented by '("" . "foo"). (defalias 'xml-node-name #[(node) "@\207" [node] 1 (#$ . 1056)]) (put 'xml-node-name 'byte-optimizer 'byte-compile-inline-expand) #@61 Return the list of attributes of NODE. The list can be nil. (defalias 'xml-node-attributes #[(node) "A@\207" [node] 1 (#$ . 1485)]) (put 'xml-node-attributes 'byte-optimizer 'byte-compile-inline-expand) #@82 Return the list of children of NODE. This is a list of nodes, and it can be nil. (defalias 'xml-node-children #[(node) "\211AA)\207" [node x] 2 (#$ . 1695)]) (put 'xml-node-children 'byte-optimizer 'byte-compile-inline-expand) #@117 Return the children of NODE whose tag is CHILD-NAME. CHILD-NAME should match the value returned by `xml-node-name'. (defalias 'xml-get-children #[(node child-name) "\306 \211\211AA*\306\211\203.\f@\211<\203' \211@) \232\203' B\fA\211\204*\237)\207" [match node x child #1=#:--cl-dolist-temp-- child-name nil] 3 (#$ . 1931)]) #@113 Get from NODE the value of ATTRIBUTE. Return nil if the attribute was not found. See also `xml-get-attribute'. (defalias 'xml-get-attribute-or-nil #[(node attribute) "\302 \211A@)\"A\207" [attribute node assoc] 4 (#$ . 2279)]) #@137 Get from NODE the value of ATTRIBUTE. An empty string is returned if the attribute was not found. See also `xml-get-attribute-or-nil'. (defalias 'xml-get-attribute #[(node attribute) "\302 \"\206\303\207" [node attribute xml-get-attribute-or-nil ""] 3 (#$ . 2516)]) (put 'xml-get-attribute 'byte-optimizer 'byte-compile-inline-expand) #@258 Parse the well-formed XML file FILE. If FILE is already visited, use its buffer and don't kill it. Returns the top node with all its children. If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. If PARSE-NS is non-nil, then QNAMES are expanded. (defalias 'xml-parse-file #[(file &optional parse-dtd parse-ns) "\304!\203r\304!q\210\212\305edp \n%*\207\306\307!\310\216r q\210\311!\210\305edp \n%+\207" [file parse-dtd parse-ns #1=#:temp-buffer get-file-buffer xml-parse-region generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) insert-file-contents] 6 (#$ . 2862)]) (byte-code "\306\307P\310\304 B\311\304!\204\312\304\313\314Q\"\210\305 B\311\305!\204,\312\305\313 \314Q\"\210\315 B\311\315!\204>\312\315\f \316Q\"\210\317 B\311\317!\204S\312\317 \320 \321R\"\210\322 B\311\322!\204d\312\322 \323P\"\210\324 B\311\324!\204y\312\324\320 \321R\"\210\325 B\311\325!\204\210\312\325\326\"\210\327 B\311\327!\204\233\312\327\330 \331Q\"\210\332 B\311\332!\204\256\312\332\333 \331Q\"\210\334 B\311\334!\204\305\312\334\335\336\337\260\"\210\340 B\311\340!\204\335\312\340\341\342\343\344\260\"\210\345 B\311\345!\204\354\312\345\346\"\210\347 B\311\347!\204 \312\347\350\n\351\n\316 \335\n\352\n\316 \321\n\353\260\"\210\354 B\311\354!\204,\312\354\355\n\316\335\n\352\n\316\321\n\356\260 \"\210\357 B\311\357!\204C\312\357\335'\336,\337\260\"\210\360 B\311\360!\204]\312\360\361%\336'\336/\337\260\"\210\362 B\311\362!\204s\312\362\363\n\321 \337\260\"\210\364 B\311\364!\204\221\312\364\335\n\316 \n\3160\n\3162\337\260 \"\210\365 B\311\365!\204\256\312\365\366\336\367\336\344\260 \"\210+\304\207" [start-chars name-chars whitespace current-load-list xml-name-start-char-re xml-name-char-re "[:alpha:]:_" "-[:digit:]." "[ \n ]" default-boundp set-default "[" "]" xml-name-re "*" xml-names-re "\\(?: " "\\)*" xml-nmtoken-re "+" xml-nmtokens-re xml-char-ref-re "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)" xml-entity-ref "&" ";" xml-pe-reference-re "%" xml-reference-re "\\(?:" "\\|" "\\)" xml-att-value-re "\\(?:\"\\(?:[^&\"]\\|" "\\)*\"\\|" "'\\(?:[^&']\\|" "\\)*'\\)" xml-tokenized-type-re "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|ENTITIES\\|NMTOKEN\\|NMTOKENS\\)" xml-notation-type-re "\\(?:NOTATION" "(" "*|" "*)\\)" xml-enumeration-re "\\(?:(" ")\\)" xml-enumerated-type-re xml-att-type-re "\\(?:CDATA\\|" xml-default-decl-re "\\(?:#REQUIRED\\|#IMPLIED\\|\\(?:#FIXED" xml-att-def-re xml-entity-value-re "\\(?:\"\\(?:[^%&\"]\\|" "\\)*\"\\|'\\(?:[^%&']\\|"] 17) #@42 Syntax table used by `xml-parse-region'. (defvar xml-syntax-table (byte-code "\305 \306\307 \nW\203\310 \311#\210 T\211\202*\312\313\211\2033 @\310 \314#\210 A\211\204#*\310\315\316#\210\310\317\316#\210\310\320\321#\210\310\322\321#\210\323\313\211\203g\f@\310\324\325 \"\326#\210\fA\211\204T*)\207" [table c #1=#:--cl-dotimes-temp-- #2=#:--cl-dolist-temp-- #3=#:--cl-dolist-temp-- make-syntax-table 31 0 modify-syntax-entry "." (9 10 13) nil " " 34 "\"" 39 46 "_" 58 (183 720 721 903 1600 3654 3782 12293 12337 12338 12339 12340 12341 12445 12446 12540 12541 12542) decode-char ucs "w"] 5) (#$ . 5486)) (byte-code "\301B\302\303!\207" [current-load-list xml-name-regexp (lambda (#1=#:defconst-tmp-var) (defconst xml-name-regexp #1#)) "[[:alpha:]_:][[:alnum:]._:-]*"] 2) #@353 Parse the region from BEG to END in BUFFER. If BUFFER is nil, it defaults to the current buffer. Returns the XML list for the region, or raises an error if the region is not well-formed XML. If PARSE-DTD is non-nil, the DTD is parsed rather than skipped, and returned as the first element of the list. If PARSE-NS is non-nil, then QNAMES are expanded. (defalias 'xml-parse-region #[(beg end &optional buffer parse-dtd parse-ns) "\306 p\307\216\310\311 !\210\312\211\211\211\212\203q\210\214}\210eb\210m\204\200\313\314\312\315#\203z\316u\210\317\"\f\203R \203R\204R\320\321!\210\202( \203( @<\203r\203r @ A\203(\322\304 A\"\210\202(\322\304 \"\210\202(db\210\202(\203\214\n\f\237B\202\216\f\237. \207" [#1=#:buffer #2=#:table dtd result xml case-fold-search syntax-table ((byte-code "rq\210\302 !\210)\302\207" [#1# #2# set-syntax-table] 2)) set-syntax-table standard-syntax-table nil search-forward "<" t -1 xml-parse-tag error "XML: (Not Well-Formed) Only one root tag allowed" add-to-list buffer beg end parse-dtd parse-ns xml-sub-parser] 4 (#$ . 6295)]) #@399 Perform any namespace expansion. NAME is the name to perform the expansion on. DEFAULT is the default namespace. XML-NS is a cons of namespace names to uris. When namespace-aware parsing is off, then XML-NS is nil. During namespace-aware parsing, any name without a namespace is put into the namespace identified by DEFAULT. nil is used to specify that the name shouldn't be given a namespace. (defalias 'xml-maybe-do-ns #[(name default xml-ns) ":\203R\306\307 \"\211\203 \310\225\311O\202 \n\203$ \310\211\224O\202%\f \312\230\205. ?\313\203:\312\202; \"A\206B\314\211\203N\314\202O -B\207\315 !\207" [xml-ns name nsp lname default prefix string-match ":" 0 nil "xmlns" assoc "" intern special ns] 4 (#$ . 7404)]) #@27 Parse xml-like fragments. (defalias 'xml-parse-fragment #[(&optional parse-dtd parse-ns) "\305\306m\204+\307\n \"\203\310\fC\"\202'\f;\203%\fC\202'\f)\202\311!*\207" [children xml-sub-parser parse-dtd parse-ns bit t nil xml-parse-tag append reverse] 3 (#$ . 8155)]) #@349 Parse the tag at point. If PARSE-DTD is non-nil, the DTD of the document, if any, is parsed and returned as the first element in the list. If PARSE-NS is non-nil, then QNAMES are expanded. Returns one of: - a list : the matching node - nil : the point is not looking at a tag. - a pair : the first element is the DTD, the second is the node. (defalias 'xml-parse-tag #[(&optional parse-dtd parse-ns) "\206 \n:\203\n\202\n\205\306\211B\307\310B\311\312BE\313\314!\2033\315\316!\210\317\320!\210\321 \"\202\251\313\322!\203T\323\225\315\324\325\326#\204H\327\330!\210\331\f\323\224\"\332 P)\202\251\313\333!\203w\334\n!\317\320!\210 \203o \321\325 \"B\202s\321\325 \")\202\251\313\335!\203\205\315\336!\210\325\202\251\313\337!\203\217\325\202\251\313\340!\203\236\341\225b\210\342\341!/\343 !0\325\2111 :\203\3510\3252\2113\203\3503@\2112@:\203\3372\2114@@)\312\232\203\3372\2114@A)2AB B3A\2113\204\270*0\344/\306 #D1\313\345!\203\346u\2101\237\202\232\325f\347=\203\220\341u\210\337/\350Q5\3135!\204\205\313\337!\203+\327\351/`#\210\202\325f\352U\203G\321\325 \"\2116\203C61B1)\202\332 \2117;\203v1@;\203i\3531@7PC1A\"\2111\202\3537C1\"\2111\202\35371\"\21111)\202\323\225b\2101\237)\202\232\327\354\331`\355Z`T\"\",\202\2518\204\247\327\356!\210\332 *\207" [parse-dtd xml-validating-parser parse-ns xml-ns pos dtd "" "xml" "http://www.w3.org/XML/1998/namespace" "xmlns" "http://www.w3.org/2000/xmlns/" looking-at "<\\?" search-forward "?>" skip-syntax-forward " " xml-parse-tag "" nil t error "XML: (Not Well Formed) CDATA section does not end anywhere in the document" buffer-substring-no-properties xml-parse-string "" "[:space:]]+\\)" 1 match-string-no-properties xml-parse-attlist xml-maybe-do-ns "/>" 2 62 "\\s-*>" "XML: (Not Well-Formed) Invalid end tag (expecting %s) at pos %d" 60 append "XML: (Well-Formed) Couldn't parse tag: %s" 10 "XML: (Well-Formed) Invalid character" node-name attrs children attr #1=#:--cl-dolist-temp-- x end tag expansion xml-sub-parser] 6 (#$ . 8445)]) #@61 Parse the next whatever. Could be a string, or an element. (defalias 'xml-parse-string #[nil "`\302\303\304\305#\203\306u\210\202db\210\307`\"\310\311\312 #\2030\313\314\305\211 $\310\224T\202\315 !*\207" [pos string search-forward "<" nil t -1 buffer-substring-no-properties 0 string-match " \n?" replace-match "\n" xml-substitute-special] 5 (#$ . 10616)]) #@100 Return the attribute-list after point. Leave point at the first non-blank character after the tag. (defalias 'xml-parse-attlist #[(&optional xml-ns) "\306\211\211\307\310!\210\311\312!\203q\313\225\314\315\316!\306 # b\210\311\317!\203*\313\225\202:\311\320!\2036\313\225\202:\321\322!\210\323\n\"\203E\321\324!\210\315\316!\313\325\326\310 #\210\327 !\211;\204_\321\330!\210B\nB+ b\210\307\310!\210\202\n\n\237+\207" [name end-pos attlist xml-ns pos string nil skip-syntax-forward " " looking-at "\\([[:alpha:]_:][[:alnum:]._:-]*\\)\\s-*=\\s-*" 0 xml-maybe-do-ns match-string-no-properties 1 "\"\\([^\"]*\\)\"" "'\\([^']*\\)'" error "XML: (Not Well-Formed) Attribute values must be given between quotes" assoc "XML: (Not Well-Formed) Each attribute must be unique within an element" replace-regexp-in-string "\\s-\\{2,\\}" xml-substitute-special "XML: (Not Well-Formed) Entities in attributes cannot expand into elements" expansion] 5 (#$ . 10996)]) #@78 Skip the DTD at point. This follows the rule [28] in the XML specifications. (defalias 'xml-skip-dtd #[nil "\301\302 )\207" [xml-validating-parser nil xml-parse-dtd] 1 (#$ . 11977)]) #@25 Parse the DTD at point. (defalias 'xml-parse-dtd #[(&optional parse-ns) "\306u\210\307\310!\210\311\312!\203\203\313\314!\210\311 !\210\315\316!\305D\317\211\211\316\225b\210\307\310!\210\311\320!\203v\316\225b\210\321\322\317\323#\204K\321\324\317\323#\204K\313\325!\210\315\326!@\307\310!\210\321\327\317\323#\204h\321\330\317\323#\204h\313\331!\210@\315\326!\332E B)\202\234\311\333!\203\234\316\225b\210\321\327\317\323#\204\224\321\330\317\323#\204\224\313\331!\210\315\326!\334D B\307\310!\210\317f\335=\203\255\317u\210\202`\317f\336=\204\273\313\337!\210\202T\317u\210\311\340!\204T\307\310!\210\311\341!\203-\315\326!\315\342!\316\225\343\344\f\"\203\345\345\202\343\346\f\"\203\361\347\202\343\350\f\"\203\351\315\326\f\"!\202\343\352\f\"\204\203\313\353!\210\354 \"\203!\203!\313\355 \"\210 \fD B\nb\210\202\276\311\356A\357B\360\260!\203B\316\225b\210\202\276\311\361!\203O\362\363!\210\202\276\311\364A\357C\365\260!\203\231\315\326!\315\342!\326\315\342!GSODE\316\225b\210\366FE\367\370!G\371\216rGq\210Dc\210eb\210\372H\"+BC\"F*\202\276\311\373A\374\375R!\204\271\311\373A\376\377\201K\201L\201M\260!\203\372\315\326!\315\342!\326\315\342!GSOIE\316\225b\210\366FE\367\370!J\201N\216rJq\210\201OI!\210eb\210\372H\"+BC\"F*\202\276\311\201PA\374\375R!\204+\311\201Q\201R\201SA\201T\201U\201V\201W\201X\201M\260\n!\2032\316\225b\210\202\276\311\201YA\201ZQ!\203G\316\225b\210\202\276\203\276\313\201[!\210\202\276\311\201\\!\203`\316\225b\210 \237,\207" [xml-validating-parser xml-name-regexp end-pos element type dtd 9 skip-syntax-forward " " looking-at ">" error "XML: (Validity) Invalid DTD (expecting name of the document)" match-string-no-properties 0 nil "PUBLIC\\s-+" re-search-forward "\\=\"\\([[:space:][:alnum:]-'()+,./:=?;!*#@$_%]*\\)\"" t "\\='\\([[:space:][:alnum:]-()+,./:=?;!*#@$_%]*\\)'" "XML: Missing Public ID" 1 "\\='\\([^']*\\)'" "\\=\"\\([^\"]*\\)\"" "XML: Missing System ID" public "SYSTEM\\s-+" system 62 91 "XML: Bad DTD" "\\s-*\\]" "]+\\)>" 2 string-match "^EMPTY[ \n ]*$" empty "^ANY[ \n ]*$" any "^(\\(.*\\))[ \n ]*$" xml-parse-elem-type "^%[^;]+;[ \n ]*$" "XML: (Validity) Invalid element type in the DTD" assoc "XML: (Validity) Element declarations must be unique in a DTD (<%s>)" "" "" "" append generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) xml-parse-fragment "" "\\)[ \n ]+PUBLIC[ \n ]+" "\"[- \na-zA-Z0-9'()+,./:=?;!*#@$_%]*\"" pubid xml-name-re xml-att-def-re xml-entity-value-re value name xml-entity-alist #1# parse-ns file #2=#:temp-buffer "\\|'[- \na-zA-Z0-9()+,./:=?;!*#@$_%]*'" "[ \n ]+\\(\"[^\"]*\"\\|'[^']*'\\)" "[ \n ]*>" ((byte-code "\301!\203\n\302!\210\301\207" [#2# buffer-name kill-buffer] 2)) insert-file-contents ""] 11 (#$ . 12167)]) #@52 Convert element type STRING into a Lisp structure. (defalias 'xml-parse-elem-type #[(string) "\303\211\304\305\n\"\203=\306\307\n\"\306\310\n\"\304\311 \"\203)\312\313\314\315 \311\"\"B\202N\304\316 \"\203N\317\313\314\315 \316\"\"B\202N\304\320\n\"\203N\306\307\n\"\306\310\n\" ;\203[ \321\230\203[\322\323\230\203g\324 D\202\200\325\230\203s\326 D\202\200\327\230\203\330 D\202\200 *\207" [modifier elem string nil string-match "(\\([^)]+\\))\\([+*?]?\\)" match-string-no-properties 1 2 "|" choice mapcar xml-parse-elem-type split-string "," seq "[ \n ]*\\([^+*?]+\\)\\([+*?]?\\)" "#PCDATA" pcdata "+" + "*" * "?" \?] 6 (#$ . 15602)]) #@53 Return STRING, after subsituting entity references. (defalias 'xml-substitute-special #[(string) "\306\307\211\310\311 \n#\203\375\306\225\312\313 \" \n\306\224O\314\f\"\310\315\f\"\203A\316\317\320\312\313\f\"!\"\211\205=\303!)\202\206\310\321\f\"\203`\316\317\320\312\313\f\"\322\"\"\211\205\\\303!)\202\206\203kA\202\206\fG\306=\203x\323\324!\202\206\203\204\323\325\f\"\202\206 \204\224  P\202\367 ;\203\262 ;\203\250  Q\202\367 PD\202\367 ;\203\312 @;\203\312  @Q\240\210\202\367 ;\203\333\326  P \"\202\367 @;\203\361 \211@ P\240\210\326 \"\202\367 E,\202 ;\203  \n\307OP\2022\327 !@;\203\327 !@ \n\307OP\2022 \204' \2022\330\331 \237\332# \n\307OP+\207" [end-point children point string this-part prev-part 0 nil string-match "&\\([^;]*\\);" match-string-no-properties 1 assoc "#\\([0-9]+\\)" decode-char ucs string-to-number "#x\\([[:xdigit:]]+\\)" 16 error "XML: (Not Well-Formed) No entity given" "XML: (Validity) Undefined entity `%s'" append last mapconcat identity "" xml-entity-alist entity c xml-validating-parser xml-undefined-entity expansion] 7 (#$ . 16273)]) #@138 Outputs the XML in the current buffer. XML can be a tree or a list of nodes. The first line is indented with the optional INDENT-STRING. (defalias 'xml-debug-print #[(xml &optional indent-string) "\206\304 \305\211\203 @\306\n\"\210 A\211\204*\305\207" [indent-string xml node #1=#:--cl-dolist-temp-- "" nil xml-debug-print-internal] 4 (#$ . 17448)]) (defalias 'xml-print 'xml-debug-print) #@92 Outputs the XML tree in the current buffer. The first line is indented with INDENT-STRING. (defalias 'xml-debug-print-internal #[(xml indent-string) "\306 \307\310\n\211@)!\261\210\n\211A@)\211\2036\311\310 \211@@)!\312 \211@A)\313\261\210 A\211\204\n\211\211AA*\211\204J\314\315\261\202\241\315c\210\n\306\211\203\204@\211<\203l\316c\210\317\f \320P\"\210\202{\f;\203w\fc\210\202{\321\322!\210A\211\204V*\nA\204\220\n@;\204\225\316 \261\210\307\314\310\211@)!\315\261*\207" [xml attlist tree indent-string node x nil 60 symbol-name 32 "=\"" 34 47 62 10 xml-debug-print-internal " " error "Invalid XML tree" #1=#:--cl-dolist-temp--] 6 (#$ . 17857)]) (provide 'xml)