GNU bug report logs -
#8516
nxml-mode: pattern matching should be case-sensitive in validation
Previous Next
Reported by: Rob Browning <rlb <at> defaultvalue.org>
Date: Sun, 17 Apr 2011 19:10:03 UTC
Severity: normal
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8516 in the body.
You can then email your comments to 8516 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8516
; Package
emacs
.
(Sun, 17 Apr 2011 19:10:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Rob Browning <rlb <at> defaultvalue.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 17 Apr 2011 19:10:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
(If possible, please preserve the 288147-forwarded address in any replies.)
Vincent Lefevre <vincent <at> vinc17.org> writes:
> Consider the following example:
> ay:~> cat test.xml
> <?xml version="1.0"?>
> <root>Test</root>
> ay:~> cat test.rnc
> default namespace = ""
> start = element root { xsd:normalizedString { pattern = "[a-z]*" } }
> When test.xml is opened in emacs, nxml-mode says that the file is valid,
> though the root element contains a "T". If I add ASCII letters (either
> lowercase or uppercase), it still says that the file is valid, but as
> soon as I add a non-letter character, nxml-mode says that the file is
> invalid, as expected.
> As a comparison, here's what I get with xmllint:
> ay:~> trang test.rnc test.rng
> ay:~> xmllint --noout --relaxng test.rng test.xml
> test.xml:2: element root: Relax-NG validity error : Error validating datatype normalizedString
> test.xml:2: element root: Relax-NG validity error : Element root failed to validate content
> test.xml fails to validate
Please see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288147 for
further information.
Thanks
--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8516
; Package
emacs
.
(Mon, 18 Apr 2011 10:54:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 8516 <at> debbugs.gnu.org (full text, mbox):
Rob Browning wrote:
> (If possible, please preserve the 288147-forwarded address in any replies.)
> Vincent Lefevre <vincent <at> vinc17.org> writes:
>> Consider the following example:
>> ay:~> cat test.xml
>> <?xml version="1.0"?>
>> <root>Test</root>
>> ay:~> cat test.rnc
>> default namespace = ""
>> start = element root { xsd:normalizedString { pattern = "[a-z]*" } }
>> When test.xml is opened in emacs, nxml-mode says that the file is valid,
>> though the root element contains a "T". If I add ASCII letters (either
>> lowercase or uppercase), it still says that the file is valid, but as
>> soon as I add a non-letter character, nxml-mode says that the file is
>> invalid, as expected.
>> As a comparison, here's what I get with xmllint:
>> ay:~> trang test.rnc test.rng
>> ay:~> xmllint --noout --relaxng test.rng test.xml
>> test.xml:2: element root: Relax-NG validity error : Error validating
>> datatype normalizedString
>> test.xml:2: element root: Relax-NG validity error : Element root
>> failed to validate content
>> test.xml fails to validate
> Please see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288147 for
> further information.
The various string-checking functions in rng-xsd.el probably need
to wrap string-match calls in a (let ((case-fold-search nil))
...)
To fix this particular problem, replace rng-xsd-check-pattern by:
(defun rng-xsd-check-pattern (str regexp convert &rest args)
(let ((case-fold-search nil))
(and (string-match regexp str)
(apply convert (cons str args)))))
Lawrence
--
Lawrence Mitchell <wence <at> gmx.li>
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8516
; Package
emacs
.
(Mon, 18 Apr 2011 16:12:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 8516 <at> debbugs.gnu.org (full text, mbox):
I think it's because string-match ignore case when case-fold-search is t
(which is the default), so greped a little on nxml dir and found the
following function may be the problem. But I haven't read the how the
whole file and don't know how nxml validation works, so some one more
knowledgeable should verify this is the right thing to do.
I tested on the test.xml and test.rnc and after this patch, capitalized
"Test" will result an invalid xml file.
Thanks,
Yuanle
--- /home/sylecn/fromsource/emacs-23.3/lisp/nxml/rng-xsd.el 2011-01-08 11:45:14.000000000 -0600
+++ /home/sylecn/fromsource/emacs/lisp/nxml/rng-xsd.el 2011-04-18 04:35:08.135816534 -0500
@@ -238,7 +238,7 @@
obj)))
(defun rng-xsd-check-pattern (str regexp convert &rest args)
- (and (string-match regexp str)
+ (and (let (case-fold-search) (string-match regexp str))
(apply convert (cons str args))))
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8516
; Package
emacs
.
(Sun, 22 May 2011 19:48:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 8516 <at> debbugs.gnu.org (full text, mbox):
Yuanle Song <sylecn <at> gmail.com> writes:
> I think it's because string-match ignore case when case-fold-search is t
> (which is the default), so greped a little on nxml dir and found the
> following function may be the problem. But I haven't read the how the
> whole file and don't know how nxml validation works, so some one more
> knowledgeable should verify this is the right thing to do.
>
> I tested on the test.xml and test.rnc and after this patch, capitalized
> "Test" will result an invalid xml file.
Patch looks right to me. Committed to the Emacs repository trunk,
thanks.
bug closed, send any further explanations to
8516 <at> debbugs.gnu.org and Rob Browning <rlb <at> defaultvalue.org>
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> debbugs.gnu.org
.
(Sun, 22 May 2011 19:48:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 20 Jun 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.