Commit Graph
23 Commits
Author SHA1 Message Date
Atsushi Eno acdf48cf71 fix bug #6653: change xs component validation logic regarding recursion check.
Originally this implementation checked recursion based on RELAX NG-inspired
algorithm explained at http://www.thaiopensource.com/relaxng/simplify.html.

This works only for "simple" syntax, which premises that every <element> is
defined under top-level <define> element. XML Schema doesn't follow this
and could result in infinite loop like reported.

The latest REC-xmlschema-1 denotes the explicit rule on illegal recursion
on 3.8.6 (Model Group Correct) as:

2 Circular groups are disallowed. That is, within the {particles} of a group there must not be at any depth a particle whose {term} is the group itself.

... so, I simply replaced the checker with simple Stack.

(oh, and for old Stack I haven't bothered to replace non-generic collection
everywhere. XSD is as dead as System.Collection.)
2013-02-08 20:19:14 +09:00
Atsushi Eno d89e9691ac 2008-02-19 Atsushi Enomoto <[email protected]>
* XsdWildcard.cs : block extra compilation and made compilation reset.
	  This somehow fixed bug #360541.

	* XmlSchemaAny.cs : block extra compilation in anyTypeContent.

	* XmlSchemasTests.cs : new test file (for bug #360541).

	* System.Xml_test.dll.sources: added XmlSchemasTests.cs.


svn path=/trunk/mcs/; revision=96115
2008-02-19 04:02:53 +00:00
Atsushi Eno 0208465123 2007-04-24 Atsushi Enomoto <[email protected]>
* XmlSchema.cs XmlSchemaGroup.cs XmlSchemaAny.cs XmlSchemaElement.cs
	  XmlSchemaNotation.cs XmlSchemaComplexType.cs
	  XmlSchemaAttributeGroup.cs XmlSchemaSimpleType.cs
	  XmlSchemaIdentityConstraint.cs XmlSchemaAnyAttribute.cs
	  XmlSchemaRedefine.cs XmlSchemaAttribute.cs :
	  avoid incorrect compilation of included schemas, fixed bug #81360.
	  more fix for wrong targetNamespace propagation within current
	  processing model. Replaced ParentIsSchema field with a property.

	* XsdValidatingReaderTests.cs : added test for bug #81360.

	* 81360.xsd, 81360inc1.xsd, 81360inc2.xsd : new test files.

	* Makefile : added distfiles.


svn path=/trunk/mcs/; revision=76184
2007-04-24 12:40:40 +00:00
Atsushi Eno d4545913a0 Now we can safely set eol-style:native.
svn path=/trunk/mcs/; revision=67665
2006-11-10 10:28:24 +00:00
Atsushi Eno 56e9bba3ea This namespace is a horrible nest of mixed line endings :-(
svn path=/trunk/mcs/; revision=67664
2006-11-10 10:27:11 +00:00
Atsushi Eno 6331ad5c79 2006-07-26 Atsushi Enomoto <[email protected]>
Refactoring compilation to make Compile() portable to
	XmlSchemaSet.Compile() and fix multi-schema bugs (not done yet)

	* XmlSchema.cs : 
	  Removed "root schema" concept from Compile().
	  Since nested inclusion does not result in an error, the role of
	  schemaLocationStack is identical to handledUris, thus removed it.
	  The handledUris does not have to be a field.
	  Moved NamedIdentities and IDCollections to XmlSchemaSet.
	  Renamed a Compile() which is called from XmlSchemaCollection and
	  XmlSchemaSet as CompileSubset(). Renamed private Compile() as
	  DoCompile().
	  public Compile() now internally creates a new XmlSchemaSet and
	  compiles the set.
	* XmlSchemaCollection.cs : now it hooks its schemaSet's validation
	  event handler and thus XmlSchemaSet does not need to check this
	  collection's event handler by itself.
	  XmlSchema.Compile() -> XmlSchema.CompileSubset().
	* XmlSchemaSet.cs :
	  Removed SchemaCollection which became unneccessary.
	  Added NamedIdentities and IDCollection.
	  XmlSchema.Compile() -> XmlSchema.CompileSubset().
	* XmlSchemaAttributeGroupRef.cs, XmlSchemaXPath.cs
	  XmlSchemaSimpleTypeList.cs, XmlSchemaComplexContentRestriction.cs,
	  XmlSchemaGroup.cs, XmlSchemaComplexContentExtension.cs,
	  XmlSchemaSequence.cs, XmlSchemaSimpleContentRestriction.cs,
	  XmlSchemaSimpleContentExtension.cs, XmlSchemaAny.cs,
	  XmlSchemaElement.cs, XmlSchemaNotation.cs, XmlSchemaAll.cs,
	  XmlSchemaComplexType.cs, XmlSchemaAnnotation.cs,
	  XmlSchemaAttributeGroup.cs, XmlSchemaSimpleTypeRestriction.cs,
	  XmlSchemaSimpleContent.cs, XmlSchemaGroupRef.cs,
	  XmlSchemaChoice.cs, XmlSchemaSimpleType.cs,
	  XmlSchemaIdentityConstraint.cs, XmlSchemaSimpleTypeUnion.cs,
	  XmlSchemaAnyAttribute.cs, XmlSchemaComplexContent.cs,
	  XmlSchemaAttribute.cs, XmlSchemaObject.cs :
	  removed XmlSchemaObject.IsCompiled(). Check compilation state by
	  comparing compilation ID directly.

	* XmlReader.cs :
	  For DTD validator, call to SetSchemas() makes no sense.
	* XmlValidatingReader.cs : now it internally holds old
	  XmlSchemaCollection instead of new XmlSchemaSet, to make
	  XmlSchemaSet.SchemaCollection unneccessary.
	  Removed SetSchemas() since it is now extraneous because of the
	  XmlReaderChange above.


svn path=/trunk/mcs/; revision=62988
2006-07-26 10:13:56 +00:00
Ben Maurer 0e8decdb37 remove svn:executable from .cs files
svn path=/trunk/mcs/; revision=46562
2005-06-27 15:51:40 +00:00
Duncan Mak 8fa6e766dd Add MIT license to System.XML.DLL
svn path=/trunk/mcs/; revision=30055
2004-06-21 18:07:31 +00:00
Ben Maurer bc37e00fc3 constify
svn path=/trunk/mcs/; revision=26464
2004-04-30 20:46:43 +00:00
Atsushi Eno a4d7dd056a 2004-02-03 Atsushi Enomoto <[email protected]>
* BuiltInDatatype.cs : Fixed some Parse() for token based datatypes.
	* XmlSchemaAny.cs : set properties for cloned particle. This will fix
	  bugzilla #53668.
	* XmlSchemaParticle.cs : copy occurence string after computation of
	  validated min/max occurence. This will fix bug #53667.

svn path=/trunk/mcs/; revision=22731
2004-02-03 08:09:06 +00:00
Atsushi Eno 110c7c12fd 2004-01-26 Atsushi Enomoto <[email protected]>
* XmlSchema.cs : Raise warning event when external schema could not
	  be resolved.
	* XmlSchemaAll.cs : Fixed incorrect IsEmptiable computation.
	* XmlSchemaAny.cs : Fixed incorrect occurence computation.
	* XmlSchemaChoice.cs : compiledItems were incorrectly appended.
	* XmlSchemaComplexType.cs : Now validatableParticle became extraneous.
	* XmlSchemaGroupBase.cs : Here we should not get optimized particle
	  because it might cause infinite loop.
	* XmlSchemaGroupRef.cs : Fixed Validate() to avoid null reference
	  exception (only occur with ValidationEventHandler).  Fixed Occurence
	  embedding logic that was useless because of particle optimization.

svn path=/trunk/mcs/; revision=22507
2004-01-26 18:24:22 +00:00
Atsushi Eno ccd5f38514 2004-01-21 Atsushi Enomoto <[email protected]>
* XmlSchema.cs :
	  - Removed extra property Language.  Fill substitution-group info
	    before ContentTypeParticle is computed.
	* XmlSchemaComplexType.cs : ContentType and ContentTypeParticle are
	  now computer before Validate() (to exclude 3.4.2 from 3.4.6
	  component constraint check).
	* XmlSchemaObject.cs, XmlSchemaParticle.cs :
	  Added CopyInfo() for cloning objects.
	* XmlSchemaObjectTable.cs :
	  Add() doesn't have to reject same named items.
	* XmlSchemaParticle.cs :
	  - Renamed internal class XmlSchemaParticleEmpty to EmptyParticle
	    (for ease of post compilation infoset comparison).
	  - GetMinEffectiveTotalRange() should return max occurs for element and
	    any.
	* XmlSchemaParticle.cs,
	  XmlSchemaAll.cs,
	  XmlSchemaAny.cs,
	  XmlSchemaChoice.cs,
	  XmlSchemaElement.cs,
	  XmlSchemaGroupBase.cs,
	  XmlSchemaGroupRef.cs,
	  XmlSchemaSequence.cs :
	  - Removed ActualParticle property.
	  - Added GetOptimizedParticle() to get ContentTypeParticle.
	  - ContentTypeParticle is now created as different object from
	    user-specified "Particle" property.
	  - Return Empty particle when model groups contains no Items.
	  - When Items contains exactly 1 item, return the item (unless it is
	    top level choice model group - it causes DBR problem).
	  - ValidateDerivationValidRestriction() and related WXS 3.9.6 DBR
	    check methods such as ValidateNSRecurseCheckCardinality() now
	    returns a bool value and avoids exceptions on each failure time.
	  - ValidateRecurse() now doesn't progress base particle incorrectly.
	    (it caused incorrect order-preserving-mapping error.)
	  - 3.9.6 Recurse, RecurseLax, MapAndSum are now treated as different.
	* XmlSchemaAll.cs : occurence validation shoud be done against values
	  after computation (ValidatedMaxOccurs).
	* XmlSchemaChoice.cs : When Items is empty, then invoke warning event.
	* XmlSchemaElement.cs :
	  - Consider referencedElement also for SubstitutionGroupElement.
	  - Removed SubstitutingChoice which is not in use.
	  - when it was targeted as substitution group by other elements, its
	    ContentTypeParticle should be substitution choice (see 3.9.6
	    Particle Valid (Restriction) term 2.1).
	  - Added FillsubstitutionElementInfo() (see XmlSchema.cs above).
	* XmlSchemaGroup.cs : Removed extra check on model group (because it
	  is impossible to specify non-model-group particle).
	* XmlSchemaIdentityConstraint.cs,
	  XmlSchemaKey.cs,
	  XmlSchemaKeyRef.cs,
	  XmlSchemaUnique.cs : Removed extraneous MonoTODO.
	* XmlSchemaSimpleContent.cs : Made actualSchemaType as internal.
	* XmlSchemaSimpleType.cs : Removed extraneous new Datatype property.
	* XmlSchemaSimpleTypeRestriction.cs : Renamed actualBaseSchemaType to
	  ActualBaseSchemaType.
	* XmlSchemaSimpleTypeList.cs, XmlSchemaSimpleTypeUnion.cs :
	  Removed unused actualBaseSchemaType code.
	* XmlSchemaType.cs : use recently introduced BaseXmlSchemaType.
	* XmlSchemaUtil.cs : Removed unused CheckLanguage().

svn path=/trunk/mcs/; revision=22323
2004-01-21 08:06:51 +00:00
Atsushi Eno 53bdf9925c 2003-12-07 Atsushi Enomoto <[email protected]>
* BuiltInDatatype.cs : XsdDecimal and XsdInteger defaults whitespace
	  facet as collapse (patch by David Sheldon).
	* XmlSchemaAnnotations.cs, XmlSchemaAny.cs : No more MonoTODOs ;-)
	* XmlSchemaSequence.cs : MapAndSum implementation.

svn path=/trunk/mcs/; revision=20830
2003-12-07 08:17:54 +00:00
Atsushi Eno 3131a7917e 2003-10-23 Atsushi Enomoto <[email protected]>
* XmlSchemaAll.cs,
	  XmlSchemaChoice.cs,
	  XmlSchemaGroupBase.cs,
	  XmlSchemaSequence.cs : Now CompiledItems went to XmlSchemaGroupBase.
	* XmlSchemaAny.cs,
	  XmlSchemaElement.cs,
	  XmlSchemaGroupBase.cs,
	  XmlSchemaGroupRef.cs,
	  XmlSchemaParticle.cs,
	  XmlSchemaSequence.cs : Added ParticleEquals() method to compare
	  whether the particles are equal in the context of WXS part 1 - 3.9.6.
	* XmlSchemaAny.cs : Implemented ValidateDerivationByRestriction().
	* XmlSchemaAnyAttribute.cs : Removed extraneous lines and added my
	  responsibility on this class.
	  Added ValidateWildcardAllowsNamespaceName().
	* XmlSchemaAttribute.cs : Added ValidatedUse which holds post-
	  compilation value of "Use".
	* XmlSchemaAttributeGroup.cs,
	  XmlSchemaAttributeGroupRef.cs : Removed MonoTODO (same as some other
	  classes) since there is no more errors on attribute stuff ;-)
	* XmlSchemaComplexType.cs : complex content extension must block
	  derivation from any built-in primitive types.
	  Fixed wildcard derivation by restriction.
	  ValidateDerivationByRestriction() now checks attribute related
	  validity of DBR (derivation by restriction).
	  Now uses ParticleEquals() for particle DBR check.
	* XmlSchemaSequence.cs : Fixed to use CompiledItems instead of Items.

svn path=/trunk/mcs/; revision=19347
2003-10-23 16:01:27 +00:00
Atsushi Eno 8282466898 2003-10-01 Atsushi Enomoto <[email protected]>
* XmlSchemaAttribute.cs, XmlSchemaComplexType.cs, XmlSchemaElement.cs,
	  XmlSchemaGroupRef.cs, XmlSchemaSimpleContentExtension.cs,
	  XmlSchemaSimpleContentRestriction.cs, XmlSchemaSimpleTypeContent.cs,
	  XmlSchemaSimpleTypeList.cs, XmlSchemaSimpleTypeUnion.cs :
	  Fixed missing sub components check. It should fix soap stuff.
	* XmlSchemaAny.cs, XmlSchemaAttribute.cs,
	  XmlSchemaAttributeGroupRef.cs, XmlSchemaContent.cs :
	  Added my responsibility on them ;-)

svn path=/trunk/mcs/; revision=18463
2003-10-01 02:58:13 +00:00
Atsushi Eno c62c061680 2003-09-30 Atsushi Enomoto <[email protected]>
* Forgot to append 8/24/2003 ChangeLog.
	* BUGS.txt, BUGS-MS.txt : Appended additional bug info.
	* BuiltInDatatype.cs, ValidationHandler.cs, XmlSchema.cs,
	  XmlSchemaAll.cs, XmlSchemaAnnotation.cs. XmlSchemaAny.cs,
	  XmlSchemaAnyAttribute.cs, XmlSchemaAttribute.cs,
	  XmlSchemaAttributeGroup.cs, XmlSchemaAttributeGroupRef.cs,
	  XmlSchemaChoice.cs, XmlSchemaCollection.cs,
	  XmlSchemaComplexContent.cs, XmlSchemaComplexContentExtension.cs,
	  XmlSchemaComplexContentRestriction.cs, XmlSchemaComplexType.cs,
	  XmlSchemaContent.cs, XmlSchemaDatatype.cs, XmlSchemaElement.cs,
	  XmlSchemaException.cs, XmlSchemaGroup.cs, XmlSchemaGroupBase.cs,
	  XmlSchemaGroupRef.cs, XmlSchemaIdentityConstraint.cs,
	  XmlSchemaKey.cs, XmlSchemaKeyref.cs, XmlSchemaNotation.cs,
	  XmlSchemaObject.cs, XmlSchemaObjectTable.cs, XmlSchemaParticle.cs,
	  XmlSchemaReader.cs, XmlSchemaSequence.cs, XmlSchemaSimpleContent.cs,
	  XmlSchemaSimpleContentExtension.cs,
	  XmlSchemaSimpleContentRestriction.cs, XmlSchemaSimpleType.cs,
	  XmlSchemaSimpleTypeContent.cs, XmlSchemaSimpleTypeList.cs,
	  XmlSchemaSimpleTypeRestriction.cs, XmlSchemaSimpleTypeUnion.cs,
	  XmlSchemaType.cs, XmlSchemaUnique.cs, XmlSchemaUtil.cs,
	  XmlSchemaXPath.cs :

	  - Almost all classes are changed to implement schema component
	    constraints, and schema validation using XsdValidatingReader.
	  - better exception messages.
	  - More datatype support.
	  and so on.

svn path=/trunk/mcs/; revision=18444
2003-09-30 19:17:56 +00:00
Atsushi Eno d51892ae10 2003-07-19 Atsushi Enomoto <[email protected]>
* XmlSchema.cs, XmlSchemaAll.cs, XmlSchemaAnnotated.cs,
	  XmlSchemaAnnotation.cs, XmlSchemaAny.cs, XmlSchemaAnyAttribute.cs,
	  XmlSchemaAttribute.cs, XmlSchemaAttributeGroup.cs,
	  XmlSchemaAttributeGroupRef.cs, XmlSchemaChoice.cs,
	  XmlSchemaComplexContent.cs, XmlSchemaComplexContentExtension.cs,
	  XmlSchemaComplexContentRestriction.cs, XmlSchemaComplexType.cs,
	  XmlSchemaElement.cs, XmlSchemaGroup.cs, XmlSchemaGroupRef.cs,
	  XmlSchemaIdentityConstraint.cs, XmlSchemaImport.cs,
	  XmlSchemaInclude.cs, XmlSchemaKey.cs, XmlSchemaKeyref.cs,
	  XmlSchemaNotation.cs, XmlSchemaObject.cs, XmlSchemaRedefine.cs,
	  XmlSchemaSequence.cs, XmlSchemaSimpleContent.cs,
	  XmlSchemaSimpleContentExtension.cs,
	  XmlSchemaSimpleContentRestriction.cs, XmlSchemaSimpleType.cs,
	  XmlSchemaSimpleTypeList.cs, XmlSchemaSimpleTypeRestriction.cs,
	  XmlSchemaSimpleTypeUnion.cs, XmlSchemaUnique.cs,
	  XmlSchemaXPath.cs,
	  As to Compile() and Validate(),
	  - Added CompilationId and check it while compiling schema components.
	  - Code refactory. Replaced literal xmlns with XmlSchema.Namespace
	  - Replaced XmlSchemaInfo with compiling XmlSchema itself (XmlSchema
	    also has PSVI components inside it, so passing itself seems enough).
	  - Related to above change, IDCollection was moved to XmlSchema, and
	    blockDefault/finalDefault/blockResolved/finalResolved resolution
	    was changed to reference only to schema.BlockDefault/FinalDefault.
	  - The similar change has done against XmlSchemaForm related stuff.
	  - Changed compilation order of schema type definitions (it is
	    workaround). First it compiles types, and then it compiles others.
	* XmlSchemaElement.cs : added ElementType PSVI contribution support.

svn path=/trunk/mcs/; revision=16435
2003-07-19 18:40:45 +00:00
Ajay kumar Dwivedi b0729d1659 2002-06-18 Dwivedi, Ajay kumar <[email protected]>
* XmlSchema: The Read and Write methods are no more [MonoTODO] :)

	* XmlSchemaAppInfo: Xml Markup is now being read.

	* XmlSchemaDocumentation: Xml Markup is now being read.

	* All: Unhandled attributes are being handled properly.

	* All: Reordered the properties in all cs files to match with MS
	       Implementation. This was required since the order is importatnt
	       for the XmlSerializer.

svn path=/trunk/mcs/; revision=5322
2002-06-18 10:47:40 +00:00
Ajay kumar Dwivedi d22745d614 2002-06-14 Dwivedi, Ajay kumar <[email protected]>
* General: Fixed a few more Bugs

svn path=/trunk/mcs/; revision=5280
2002-06-14 10:42:02 +00:00
Ajay kumar Dwivedi 74f114a665 2002-06-10 Dwivedi, Ajay kumar <[email protected]>
* XmlSchemaReader: A Wrapper class around XmlReader with customized
	  methods to suit reading a schema.
	* General: Implemented Read() method for the schema. There are only
	  a few minor bugs remaining.

svn path=/trunk/mcs/; revision=5200
2002-06-10 08:36:16 +00:00
Ajay kumar Dwivedi ac520c1140 2002-05-25 Dwivedi, Ajay kumar <[email protected]>
* BUGS.txt: New file to keep track of bugs

	* ALL: All classes are initialized exactly as in .NET except
	       1. inclusion of language attribute in schema
	       2. ComplexContent's Particle is initialized to null whereas .NET
	          to some internal implementation. IMO Null is more appropriate

	* ALL: Changed the Compile methods to return the count of errors.

	* ALL: Complile methods are almost complete. Pass 1453 of 3061 tests.
	       This number should shoot up if we write a parser to read the
	       Schema instead of using reflection (which is slower too)

svn path=/trunk/mcs/; revision=4926
2002-05-25 00:02:55 +00:00
Duncan Mak bbca9ecade 2002-03-27 Duncan Mak <[email protected]>
* *.cs: Updates from Ajay Dwivedi <[email protected]>.

svn path=/trunk/mcs/; revision=3383
2002-03-27 02:06:09 +00:00
Miguel de Icaza aa2c54ee1f Add System.Xml.Schema from Ajay
svn path=/trunk/mcs/; revision=3216
2002-03-19 15:27:27 +00:00