Re: [xml] A rare bug?
- From: Daniel Veillard <veillard redhat com>
- To: David Zhuo <dzhuo1 gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] A rare bug?
- Date: Fri, 4 Jan 2008 23:15:39 -0500
On Thu, Jan 03, 2008 at 03:34:07PM -0800, David Zhuo wrote:
hi All,
I have a schema and a XML file and used xmllint to verify that the XML
is in fact confirm to the schema. The rare problem I am running into
is that different version of xmllint will have very different behavior
and I am not certain which version is at fault. Here is an example:
$ /usr/bin/xmllint --version
/usr/bin/xmllint: using libxml version 20620
compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer
XInclude Iconv Unicode Regexps Automata Schemas Modules
$ /usr/bin/xmllint --noout --schema
[1]http://www.youtube.com/xsd/metadata_0.2.xsd /tmp/test.xml
/tmp/test.xml validates
a new version 20623, however, fails:
$ /usr/bin/xmllint --version
/usr/bin/xmllint: using libxml version 20623
compiled with: Threads Tree Output Push Reader Patterns Writer
SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer
XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas
Schematron Modules Debug
$ /usr/bin/xmllint --noout --schema
[2]http://www.youtube.com/xsd/metadata_0.2.xsd /tmp/test.xml
/tmp/test.xml:18: element keywords: Schemas validity error : Element
'{ [3]http://search.yahoo.com/mrss}keywords': [facet 'pattern'] The
value 'London,Sci Fi,Aliens' is not accepted by the pattern
'(.*,){2,}.*'.
/tmp/test.xml:18: element keywords: Schemas validity error : Element
'{ [4]http://search.yahoo.com/mrss}keywords': 'London,Sci Fi,Aliens'
is not a valid value of the local atomic type.
/tmp/test.xml fails to validate
the test is performed with the same XML and schema and the only
different is the version of xmllint used. Build version 20620
successfully validate the XML while version 20623 does not.
the sample XML is attached. can someone tell me if this is a bug or
not?
There have been some rather nasty bugs introduced, and then fixed in libxml2
regexp engine over the last 2 years. I really suggest you try with very recent
versions for XSD validation like 2.6.30
In your example it seems the regexp should match as your string includes at
least 2 commas, and indeed the latest version validates it:
laptop:~/XML -> ./testRegexp '(.*,){2,}.*' 'London,Sci Fi,Aliens'
Testing (.*,){2,}.*:
London,Sci Fi,Aliens: Ok
laptop:~/XML ->
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]