1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-27 03:21:26 +03:00
Commit Graph

242 Commits

Author SHA1 Message Date
Csaba László
1f6c42cffd Fix an old bug in xmlSchemaValidateOneElement
Recently I have run into the very same problem Tiberius Duluman did back in
Wed, 13 May 2009 15:56:55 +0300 ([xml] Bug in xmlSchemaValidateOneElement
function). Now I can proof now that his problem is a valid problem. I checked
the latest available version of xmlschemas.c (2.9.0.) and the problem is still
there!
I think I have found a solution to the problem which I'd like proof with you:
My quick solution to the problem is to replace line 27849 in
xmlschemas.c
(v2.9.0.) in function xmlSchemaVDocWalk
    valRoot = xmlDocGetRootElement(vctxt->doc);
with this one:
    valRoot = vctxt->validationRoot ? vctxt->validationRoot : xmlDocGetRootElement(vctxt->doc);
Currently I'm using version 2.7.8. in Windows and this change seems to solve
the problem.
2013-03-18 15:30:00 +08:00
Daniel Veillard
c100e69c4b fix schema validation in combination with xsi:nil
Based on Thomas Gamper <icicle@cg.tuwien.ac.at> findings and
initial patch

There is no point doing a regexp validation of further
content if there actually is no further content because the
element is nilled.
2013-02-28 19:02:32 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Daniel Veillard
c70d185a2a Fix an XSD error when generating internal automata
When generating a sequence add an extra epsilon transition
to avoid further constructs from entering via the last state
Bug reported by Johan Corveleyn <jcorvel@gmail.com>
2012-08-23 23:28:04 +08:00
Daniel Veillard
ef4526ad42 Fix a variable name in comment 2012-08-15 09:15:30 +08:00
Daniel Veillard
97fa5b3c8f Fix file and line report for XSD SAX and reader streaming validation
Things now work correctly at the xmllint level:
thinkpad:~/XML -> xmllint --sax --noout --schema test_schema.xsd
test_xml.xml
test_xml.xml:72721: Schemas validity error : Element 'level1': Missing
child element(s). Expected is ( level2 ).
test_xml.xml fails to validate
thinkpad:~/XML -> xmllint --stream --schema test_schema.xsd test_xml.xml
test_xml.xml:72721: Schemas validity error : Element 'level1': Missing
child element(s). Expected is ( level2 ).
test_xml.xml fails to validate
thinkpad:~/XML ->

* error.c: fix a corner case of not reporting lines when we should
* include/libxml/xmlschemas.h doc/symbols.xml: had to add new entry
  points to set the filename on a validation context and a locator
  callback used to fetch the line and file from the context
* xmlschemas.c: add the new entry points xmlSchemaValidateSetFilename()
  and xmlSchemaValidateSetLocator(), plus make sure the error reporting
  routine gets the information if available. Add a locator for SAX.
* xmlreader.c: add and plug a locator for readers.
2012-08-14 11:01:07 +08:00
Remi Gacogne
4609e6c980 XSD: optional element in complex type extension
For https://bugzilla.gnome.org/show_bug.cgi?id=609796
Libxml2 fails to validate an instance document against a schema if an element
whose type is a complex extension of some base type with an optional child
element and that child element is not specified in the instance document.  For
example, suppose I have some complex type BaseType that is defined to have one
child element in a sequence group that has minOccurs set to 0
2012-05-11 15:31:05 +08:00
Ryan Sleevi
5cf1deb080 Fix a logic error in Schemas Component Constraints 2012-02-29 10:56:32 +08:00
Toyoda Eizi
8bb12988c4 Fix XSD validation bug #630130
This bug in xmlschemas made validation with the GML Schemas fail
Test cases to be commited separately
2011-08-04 16:40:48 +08:00
Jim Panetta
c84e863c9c 627987 Fix XSD IDC errors in imported schemas
Fix XSD IDC references when xsi:schemalocation is used for
referencing the validation schemas
2010-11-03 21:05:18 +01:00
Rob Richards
410d2c4e90 Fix memory leak when doc is NULL
* xmlschemas.c: fix memory leak when doc is NULL
2009-09-24 11:00:16 -04:00
Daniel Veillard
594e5dfb48 Chasing dead assignments reported by clang-scan
* SAX2.c dict.c error.c hash.c nanohttp.c parser.c python/libxml.c
  relaxng.c runtest.c tree.c valid.c xinclude.c xmlregexp.c xmlsave.c
  xmlschemas.c xpath.c xpointer.c: mostly removing unneded affectations,
  but this led to a few real bugs and some part not yet understood
  (relaxng/interleave)
2009-09-07 14:58:47 +02:00
Daniel Veillard
d44b936499 A few more safety cleanup raised by scan
* SAX2.c encoding.c parser.c xmlschemas.c: a few more safety checks
* relaxng.c: remove an unused intitialization
2009-09-07 12:15:08 +02:00
Daniel Veillard
76d364583e Fixing assorted potential problems raised by scan
* encoding.c parser.c relaxng.c runsuite.c tree.c xmlreader.c
  xmlschemas.c: nothing really serious but better safe than sorry
2009-09-07 11:19:33 +02:00
Daniel Veillard
4013e83e84 579746 XSD validation not correct / nilable groups
* xmlschemas.c: when a particle need to be processed via counted
  transition, if the group is nillable, the counting won't work, so
  keep track of nillable subset as they are built and generate the
  appropriate epsilon transitions as needed
* test/schemas/579746* result/schemas/579746*: add related test cases
  based on the bug report
2009-08-26 17:24:31 +02:00
Daniel Veillard
bd56c44349 571271 fix semantic of xsd:all with minOccurs=0
* xmlschemas.c: apparently we though it allowed any of the sub elements
  to be missing, and probably not what's expected from the spec, though
  it used to forbid it c.f.:
  http://lists.xml.org/archives/xml-dev/200109/msg00512.html
  asking HT for confirmation but it's likely that we were wrong on the
  semantic
* result/schemas/all_1_[367]*: this changes the output of soem of our
  internal regression tests
2009-08-12 15:39:23 +02:00
Wayne Jensen
99f7ac7f66 585505 – Document ids and refs populated by XSD
* xmlschemas.c: simple patch allowing document ids and refs to be
  asserted when XSD validation is done.
2009-08-07 21:27:44 +02:00
Jason Childs
edc68aadf8 582906 XSD validating multiple imports of the same schema
* xmlschemas.c: When validating a schema that includes the same file
  that has no targetNamespace defined an internal erro was thrown,
  depending on the orig namespace that should be allowed though
* test/schemas/582906-* result/schemas/582906-*: 2 tests case, one
  where this is allowed, and one where this is forbidden
2009-08-07 20:29:33 +02:00
Jason Childs
d996072077 Bug 582887 – problems validating complex schemas
* xmlschemas.c: fixes the problem faced when importing the same schemas
  multiple times but from different places which is allowed
* test/schemas/582887* result/schemas/582887*: adding the specific test
  to the regressions
2009-08-07 19:01:32 +02:00
Miroslav Bajtos
8f58f89d37 Bug 579729 – fix XSD schemas parsing crash
* xmlschemas.c: a typo in XSD schema validation, where inherited
  bfminlen rewrote blength and caused SIGSEGV
2009-08-07 17:22:12 +02:00
Daniel Veillard
2cdd17e290 Fix an XSD validation crash
* xmlschemas.c: fix a crash reported by Daniel Albeseder #589895
2009-07-27 21:16:13 +02:00
Daniel Veillard
bccae2d210 * c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c
valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string
  patch by Christian Persch, fixes #581612
2009-06-04 11:22:45 +02:00
Daniel Veillard
1572425c27 preparing 2.7.0 release remove some testing traces remove some warnings
* configure.in, doc/*: preparing 2.7.0 release
* tree.c: remove some testing traces
* parser.c xmlIO.c xmlschemas.c: remove some warnings
Daniel

svn path=/trunk/; revision=3788
2008-08-30 15:01:04 +00:00
Daniel Veillard
bf9c1dad3a add the testchar to 'make check' Volker Grabsch pointed out a typo
* Makefile.am: add the testchar to 'make check'
* xmlschemas.c: Volker Grabsch pointed out a typo
* xmlregexp.c: production [19] from XML Schemas regexps were a
  mistake removed in version REC-xmlschema-2-20041028, Volker Grabsch
  provided a patch to remove it
* test/schemas/regexp-char-ref_0.xml test/schemas/regexp-char-ref_0.xsd
  test/schemas/regexp-char-ref_1.xsd result/schemas/regexp-char-ref_0_0
  result/schemas/regexp-char-ref_1_0: Volker Grabsch also provided
  regession tests for this
Daniel

svn path=/trunk/; revision=3776
2008-08-26 07:46:42 +00:00
Rob Richards
c6947bb74f fix crash with invalid whitespace facet
* xmlschemas.c: fix crash with invalid whitespace facet

svn path=/trunk/; revision=3750
2008-06-29 15:04:41 +00:00
Daniel Veillard
438ebbd59a fx compilation when configured without the reader should fix #513110
* xmlschemas.c runtest.c testapi.c include/libxml/xmlreader.h
  python/types.c python/libxml_wrap.h python/libxml.c: fx compilation
  when configured without the reader should fix #513110
* doc/*: regenerated
Daniel

svn path=/trunk/; revision=3743
2008-05-12 12:58:46 +00:00
Daniel Veillard
dee23485f6 added new function xmlSchemaValidCtxtGetParserCtxt based on Holger
* include/libxml/xmlschemas.h xmlschemas.c: added new function
  xmlSchemaValidCtxtGetParserCtxt based on Holger Kaelberer patch
* doc/apibuild.py doc/*: regenerated the doc, chased why the new
  function didn't got any documentation, added more checking in the
  generator
* include/libxml/relaxng.h include/libxml/schematron.h
  include/libxml/xmlschemas.h include/libxml/c14n.h
  include/libxml/xmlregexp.h include/libxml/globals.h
  include/libxml/xmlreader.h threads.c xmlschemas.c: various changes
  and cleanups following the new reports
Daniel

svn path=/trunk/; revision=3738
2008-04-11 12:58:43 +00:00
Daniel Veillard
33fe28885c extend the cleanup rule space cleanup Daniel
* Makefile.am: extend the cleanup rule
* xmlschemas.c: space cleanup
Daniel

svn path=/trunk/; revision=3737
2008-04-10 08:09:25 +00:00
Daniel Veillard
b3e453675a fix a problem in externalSubsetSplit with a patch from Ashwin Daniel
* xmlschemas.c: fix a problem in externalSubsetSplit with a patch
  from Ashwin
Daniel

svn path=/trunk/; revision=3716
2008-03-26 13:39:31 +00:00
Daniel Veillard
77fbc3ea90 fix an XML Schemas crash raised by Stefan Behnel when testing with W3C
* xmlschemas.c: fix an XML Schemas crash raised by Stefan Behnel
  when testing with W3C test suite
Daniel

svn path=/trunk/; revision=3712
2008-03-24 14:06:19 +00:00
Daniel Veillard
7d0ca5e88c apply fix suggested by Ashwin correcting a cut-n-paste error about the SAX
* schemas.c: apply fix suggested by Ashwin correcting a cut-n-paste
  error about the SAX callback in cdataBlockSplit when streaming
  XSD validation 
Daniel

svn path=/trunk/; revision=3684
2008-02-05 08:43:52 +00:00
Daniel Veillard
3888f47263 applied patch from Frank Gross fixing Schemas IDC import bug #455953 and
* xmlschemas.c test/schemas/*455953* result/schemas/bug455953*:
  applied patch from Frank Gross fixing Schemas IDC import bug
  #455953 and also add the test to the regression suite
Daniel

svn path=/trunk/; revision=3652
2007-08-23 09:29:03 +00:00
Daniel Veillard
65fcf27ab8 applied patch for xsi:nil from Frank Gross, this should fix bug #358125
* xmlschemas.c: applied patch for xsi:nil from Frank Gross, this
  should fix bug #358125
Daniel

svn path=/trunk/; revision=3643
2007-07-11 17:55:30 +00:00
Daniel Veillard
734e76675f fix a crash on solaris when a printf %s with a NULL argument occurs,
* xmlschemas.c: fix a crash on solaris when a printf %s with a NULL
  argument occurs, should fix #450936
Daniel

svn path=/trunk/; revision=3641
2007-06-26 11:30:31 +00:00
William M. Brack
06559b3add fixed problem with referenced attribute groups (bug #417621) re-ordered
* xmlschemas.c: fixed problem with referenced attribute groups
  (bug #417621)
* configure.in: re-ordered some includes for types.h / socket.h
  (bug 416001)

svn path=/trunk/; revision=3590
2007-03-14 09:34:15 +00:00
Kasimier T. Buchcik
deb58713d7 While investigating bug #350247, I noticed that xmlSchemaIDCMatcher
* xmlschemas.c: While investigating bug #350247, I noticed
  that xmlSchemaIDCMatcher structs are massively recreated
  although only a maximum of 3 structs is used at the same
  time; added a cache for those structures to the
  validation context.
2006-08-15 12:52:30 +00:00
Daniel Veillard
6f9b0878c0 applied patch from Marton Illes to fix an allocation bug in
* xmlschemas.c: applied patch from Marton Illes to fix an allocation
  bug in xmlSchemaXPathEvaluate should close #351032
Daniel
2006-08-12 14:09:01 +00:00
Daniel Veillard
1131e116a0 applied patch from Bertrand Fritsch to fix a bug in
* xmlschemas.c: applied patch from Bertrand Fritsch to fix a bug in
  xmlSchemaClearValidCtxt
Daniel
2006-08-07 11:02:54 +00:00
Kasimier T. Buchcik
f896d44aac Fixed bug #347316, reported by David Belius: The simple type, which was
* xmlschemas.c: Fixed bug #347316, reported by David Belius:
  The simple type, which was the content type definition
  of a complex type, which in turn was the base type of a
  extending complex type, was missed to be set on this
  extending complex type in the derivation machinery.
2006-07-12 15:18:08 +00:00
Kasimier T. Buchcik
e5f810f69b A warning will now be reported in the value of the XSD attribute
* xmlschemas.c: A warning will now be reported in the value of
  the XSD attribute 'schemaLocation' does not consist of tuples
  (namespace-name, document-URI). A warning will be reported
  if a schema document could not be found at the specified
  location (via 'schemaLocation' or
  'noNamespaceSchemaLocation').
* include/libxml/xmlerror.h: Added XML_SCHEMAV_MISC to
  xmlParserErrors.
2006-05-30 09:41:25 +00:00
Kasimier T. Buchcik
9b02e295c1 Fixed bug #341337, reported by David Grohmann. The code expected a node
* xmlschemas.c: Fixed bug #341337, reported by David Grohmann.
  The code expected a node (xmlNodePtr) on the info for a
  non-existent default attribute, which clearly cannot be
  expected, since the attribute does not exist. I can only
  guess that this sneaked trying to eliminate the query
  for the owner-element, which is unavoidable actually.
  Note that creation of default attributes won't have an
  effect if validating via SAX/XMLReader; i.e., the processor
  won't fire additional start-attribute events (I'm not even
  sure if Libxml2 has such a SAX-event; I think it hands them
  all over in the start-element event).
2006-05-11 16:25:44 +00:00
Kasimier T. Buchcik
92b394fcf3 Fixed bug #341150, reported by Michael Romer. In
* xmlschemas.c: Fixed bug #341150, reported by Michael Romer.
  In xmlSchemaBuildContentModelForSubstGroup(),
  xmlAutomataNewOnceTrans2() was incorrectly used instead of
  xmlAutomataNewTransition2() to mimic a xs:choice for
  substitution-groups.
* test/schemas/subst-group-1_1.xsd
  test/schemas/subst-group-1_0.xml
  result/schemas/subst-group-1_0_1
  result/schemas/subst-group-1_0_1.err: Added regression test
  supplied by Michael Romer for bug #341150.
2006-05-09 19:59:54 +00:00
Kasimier T. Buchcik
146a982e73 We'll raise an internal error and stop validation now when an entity is
* xmlschemas.c: We'll raise an internal error and stop
  validation now when an entity is found in the instance
  document, since we don't support automatic entity
  substitution by the schema processor (yet?) -
  see bug #340316, reported by Nick Wellnhofer.
2006-05-04 17:19:07 +00:00
Kasimier T. Buchcik
b63d2fab2d Fixed incorrect validation of restricted enumerations. Added related
* xmlschemas.c test/schemas/restriction-enum-1*
  result/schemas/restriction-enum-1*: Fixed incorrect
  validation of restricted enumerations. Added related
  regression tests.
2006-04-19 11:20:49 +00:00
Daniel Veillard
cdf59aa58f fixing a deallocation problem in xmlSchemaAddSchemaDoc() in case of
* xmlschemas.c: fixing a deallocation problem in xmlSchemaAddSchemaDoc()
  in case of errors, should fix bug #338303
Daniel
2006-04-13 07:50:11 +00:00
Daniel Veillard
b294717b25 removed unused code or variables, from Stefan Kost fixing #336163 and
* xmlschemas.c: removed unused code or variables, from Stefan Kost
  fixing #336163 and #336164
Daniel
2006-03-27 09:45:01 +00:00
Daniel Veillard
fef73a55c2 applied patch from Stefan Kost fixing #336160 Daniel
* xmlschemas.c: applied patch from Stefan Kost fixing #336160
Daniel
2006-03-27 09:38:57 +00:00
Daniel Veillard
aac7c68e87 fix a few warning raised by gcc-4.1 and latests changes Daniel
* c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few
  warning raised by gcc-4.1 and latests changes
Daniel
2006-03-10 13:40:16 +00:00
Daniel Veillard
14b5643947 more cleanups based on coverity reports. Daniel
* relaxng.c xmlschemas.c xmlschemastypes.c: more cleanups based
  on coverity reports.
Daniel
2006-03-09 18:41:40 +00:00
Kasimier T. Buchcik
4c0aa16e43 Fixed a side-effect of the previous XSI bugfix: The constructor needs a
* xmlschemas.c: Fixed a side-effect of the previous XSI bugfix:
  The constructor needs a bucket to be assigned during component
  fixup.
2006-02-20 14:47:08 +00:00