Commit graph

91 commits

Author SHA1 Message Date
Chong Yidong
4d4ddaa78c * xml.el (xml-entity-or-char-ref-re): Fix regexp.
This bug was reported by Jae-oh Kim; it was posted to bug-gnu-emacs
but didn't show up in the bug tracker for some reason.  It is a
regression against Emacs 24.2.
2013-01-23 14:25:50 +08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Chong Yidong
17975d7ff9 * xml.el (xml-escape-string): Don't refer to xml-entity-alist.
Fixes: debbugs:12228
2012-08-19 14:37:15 +08:00
David Engster
049a0936ca Maybe return expanded XML qnames as plain symbols (Bug#11916).
* xml.el (xml-node-name, xml-parse-file, xml-parse-region):
Explanation of new 'symbol-qnames feature in doc-strings.
(xml-maybe-do-ns): Return expanded names as plain symbols if
'symbol-qnames was provided in XML-NS argument (Bug#11916).
(xml-parse-tag-1): Deal with new definition of PARSE-NS argument.
2012-07-28 11:19:53 +02:00
Chong Yidong
566df3fcac Clean up syntax-table usage in xml.el
* xml.el (xml--parse-buffer): Use xml-syntax-table.
(xml-parse-tag): Likewise, and avoid changing entity tables.
(xml-syntax-table): Define from scratch, making sure not to give
x2000 and other Unicode spaces whitespace syntax, since those are
not spaces in XML.
(xml-parse-fragment): Delete unused function.
(xml-name-start-char-re, xml-name-char-re, xml-name-re)
(xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re)
(xml-entity-ref, xml-pe-reference-re)
(xml-reference-re,xml-att-value-re, xml-tokenized-type-re)
(xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re)
(xml-att-type-re, xml-default-decl-re, xml-att-def-re)
(xml-entity-value-re): Use syntax references in regexps where
possible; no need to define inside a let-binding.
(xml-parse-dtd): Use xml-pe-reference-re.
(xml-entity-or-char-ref-re): New defconst.
(xml-parse-string, xml-substitute-special): Use it.
2012-07-05 00:14:05 +08:00
Stefan Monnier
30eabd7ad8 * lisp/xml.el (xml-name-regexp): Remove, redundant. Use xml-name-re. 2012-07-03 23:31:34 -04:00
Chong Yidong
a76e6535dc * xml.el: Protect parser against XML bombs.
(xml-entity-expansion-limit): New variable.
(xml-parse-string, xml-substitute-special): Use it.
(xml-parse-dtd): Avoid infloop if the DTD is not terminated.

* test/automated/xml-parse-tests.el: Update testcases.
2012-07-03 13:28:42 +08:00
Chong Yidong
a7aef6f5c6 * lisp/xml.el: Handle entity and character reference expansion correctly.
(xml-default-ns): New variable.
(xml-entity-alist): Use XML spec definitions for lt and amp.
(xml-parse-region): Make first two arguments optional.  Discard
text properties.
(xml-parse-tag-1): New function, spun off from xml-parse-tag.  All
callers changed.
(xml-parse-tag): Call xml-parse-tag-1.  For backward
compatibility, this function should not modify buffer contents.
(xml-parse-tag-1): Fix opening-tag regexp.
(xml-parse-string): Rewrite, handling entity and character
references properly.
(xml--entity-replacement-text): Signal an error if a parameter
entity is undefined.

* test/automated/xml-parse-tests.el (xml-parse-tests--data): More
testcases.
2012-07-03 00:21:54 +08:00
Chong Yidong
6fe566a752 * xml.el (xml-parse-dtd): Use proper regexps for ELEMENT declarations.
* test/automated/xml-parse-tests.el: Update testcase.

Fixes: debbugs:7172
2012-07-01 19:05:17 +08:00
Chong Yidong
fbf2e7ad3b Improve xml parameter entity parsing, and add a new ERT test.
* test/automated/xml-parse-tests.el: New file.

* lisp/xml.el (xml--parse-buffer): New function.  Move most of
xml-parse-region here.
(xml-parse-region): Copy region into a temporary buffer, since
parameter entity substitution requires changing buffer contents.
Use xml--parse-buffer.
(xml-parse-file): Use xml--parse-buffer.
(xml-parse-dtd): Make parameter entity substitution work right.
2012-07-01 15:17:05 +08:00
Chong Yidong
b3218de111 Fix use of eval-and-compile in regexps in xml.el.
* xml.el (xml-*-re): Convert defvars into defconsts, and
eval-and-compile them so eval-and-compile works on derivatives.
(xml--entity-replacement-text): Use eval-and-comple.
2012-06-30 22:21:24 +08:00
Chong Yidong
53dc3c68ea xml.el: Fix last change. 2012-06-30 21:57:55 +08:00
Chong Yidong
7f3fbd5d73 * xml.el: Implement XML parameter entities.
(xml-parameter-entity-alist): New variable.
(xml-parse-region, xml-parse-fragment): Preserve previous values
of xml-entity-alist and xml-parameter-entity-alist, so that
repeated calls on different documents do not change them.
(xml-parse-tag): Fix doctype regexp.
(xml--entity-replacement-text): New function.
(xml-parse-dtd): Use it.  Don't handle system entities; doing that
properly requires url retrieval which is unimplemented.
(xml-escape-string): Doc fix.
2012-06-30 19:33:22 +08:00
Chong Yidong
772b2e2ce2 * xml.el (xml-parse-tag): Corrrectly handle comment embedded in non-tag text. 2012-06-24 23:06:24 +08:00
Chong Yidong
18edb22d4f Fix xml.el regression introduced by 2012-01-27 change.
* lisp/xml.el (xml-parse-region, xml-parse-tag): Avoid errors due to
reaching eob.

Fixes: debbugs:11286
2012-04-21 17:53:37 +08:00
Alex Harsanyi
a268160b06 * xml.el (xml-parse-tag): Fix parsing of comments.
Fixes: debbugs:10405
2012-01-27 16:46:10 +08:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Juanma Barranquero
cd1181dbec Fix typos. 2011-11-20 04:48:53 +01:00
Paul Eggert
91af3942e9 Spelling fixes. 2011-11-14 15:59:56 -08:00
Juanma Barranquero
06b605171f lisp/*.el: Lexical-binding cleanup. 2011-04-19 15:44:55 +02:00
Glenn Morris
73b0cd5003 Convert consecutive FSF copyright years to ranges. 2011-01-24 20:08:28 -08:00
Glenn Morris
0d9f702fd0 Nuke arch-tags. 2011-01-15 15:16:57 -08:00
Glenn Morris
5df4f04cd3 Add 2011 to FSF/AIST copyright years. 2011-01-02 15:50:46 -08:00
Chong Yidong
01b229d127 * xml.el (xml-parse-region): Avoid infloop (Bug#5281). 2010-06-30 16:34:06 -04:00
Glenn Morris
114f9c9679 Add 2010 to copyright years. 2010-01-13 00:35:10 -08:00
Ulf Jasper
571855b631 Fixed Bug#5008. 2009-12-06 18:13:19 +00:00
Glenn Morris
ae940284fa Add 2009 to copyright years. 2009-01-05 03:18:22 +00:00
Chong Yidong
98b6923268 (xml-parse-string): Use skip-chars-forward. 2008-10-05 19:01:53 +00:00
Glenn Morris
eb3fa2cfcf Switch to recommended form of GPLv3 permissions notice. 2008-05-06 08:06:51 +00:00
Mark A. Hershberger
76a6127f0e * xml.el (xml-escape-string): Don't do any encoding changes on the string. 2008-01-17 17:21:34 +00:00
Miles Bader
59ce725a3b Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-987
2008-01-08 20:46:54 +00:00
Glenn Morris
409cc4a3ea Add 2008 to copyright years. 2008-01-07 02:45:14 +00:00
Mark A. Hershberger
a1884c78c4 Forgot docstring on xml-escape-string 2007-12-18 03:29:10 +00:00
Mark A. Hershberger
7731c9f401 fix up xml-debug-print 2007-12-18 03:22:05 +00:00
Glenn Morris
b4aa60262c Switch license to GPLv3 or later. 2007-07-25 04:50:21 +00:00
Chong Yidong
f6fcdfff17 * xml.el (xml-parse-tag, xml-parse-string, xml-parse-attlist)
(xml-parse-dtd, xml-parse-elem-type, xml-substitute-special):
Return to use of the -no-properties variants.  There was
consensus on emacs-devel that the speed of these variants was
prefered since we are usually parsing files (from the internet
or on disk) instead of XML created in Emacs.
2007-03-17 18:55:52 +00:00
Glenn Morris
d7a0267c8d Add 2007 to copyright years. 2007-01-21 03:53:13 +00:00
Richard M. Stallman
882cb60d1a (xml-parse-file): Clean up, and use with-temp-buffer. 2006-07-24 18:02:10 +00:00
Thien-Thi Nguyen
aaef169dc6 Update years in copyright notice; nfc. 2006-02-06 15:23:23 +00:00
Mark A. Hershberger
39d58fc034 use provided patch 2006-02-02 01:07:11 +00:00
Mark A. Hershberger
5178753d31 fixing bug report 2006-02-02 01:02:31 +00:00
Mark A. Hershberger
aaaa8abbd0 xml.el fixes 2005-11-03 03:56:38 +00:00
Richard M. Stallman
0bf41002b4 (xml-att-def-re): Add defvar. 2005-08-09 02:52:15 +00:00
Thien-Thi Nguyen
0d30b33766 Update years in copyright notice; nfc. 2005-08-06 22:13:43 +00:00
Lute Kamstra
086add1519 Update FSF's address. 2005-07-04 23:32:44 +00:00
Mark A. Hershberger
23d519e49c eliminate use of inefficient match-data 2005-06-10 15:37:37 +00:00
Mark A. Hershberger
f8ab034e35 2005-05-26 Mark A. Hershberger <mah@everybody.org>
* xml.el (xml-substitute-special): Don't die for undefined xml
	entities.
2005-05-26 14:35:47 +00:00
Richard M. Stallman
5ed3235280 (xml-name-re, xml-entity-value-re): Add defvars. 2004-12-13 19:37:32 +00:00
Mark A. Hershberger
63b446bce0 Skip parameter entity declarations. 2004-12-02 07:48:25 +00:00
Mark A. Hershberger
27720433ac Change existence of &; to not-well-formed. 2004-12-02 07:19:03 +00:00