GNU bug report logs - #8516
nxml-mode: pattern matching should be case-sensitive in validation

Previous Next

Package: emacs;

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.

Full log


Message #8 received at 8516 <at> debbugs.gnu.org (full text, mbox):

From: Lawrence Mitchell <wence <at> gmx.li>
To: 8516 <at> debbugs.gnu.org
Cc: 288147-forwarded <at> bugs.debian.org
Subject: Re: bug#8516: nxml-mode: pattern matching should be case-sensitive in
	validation
Date: Mon, 18 Apr 2011 11:52:42 +0100
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>




This bug report was last modified 13 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.