Skip to content

Commit

Permalink
Remove erroneous curlies in Xml resource (#33890)
Browse files Browse the repository at this point in the history
* Added test for Issue 30218, use of resource Sch_MinLengthGtBaseMinLength

* Reworded error message to remove the invalid formatters.

Issue #30218

* Updated check of message from the exception to be more amenable to potential internationalization.

* Reworded resource Sch_MaxLengthGtBaseMaxLength and added unit test for same.

* Simplified test code per feedback from Dan Moseley, PR#33890.

* Tests to increase code coverage.   The ones that are failing trigger resource string Sch_MaxMinLengthBaseLength to be used as the Exception message.

* Removed invalid formatters from the resource string Sch_MaxMinLengthBaseLength.  Failing tests from the previous commit now pass.

* Added test for the Exception using string resource Sch_LengthGtBaseLength as its message.  This covers a source line and branch not previously covered.  This test fails due to the invalid formatters.

* Reworded string resource Sch_LengthGtBaseLength to remove the invalid formatters.

* Added unit tests for uses of string resource Sch_FacetBaseFixed.

* Made test for the message containing "fixed" more specific.

* Reworded string resource Sch_FacetBaseFixed to remove the invalid formatter.

* Added unit test to cover usage of string resource Sch_InvalidAllMax.  A second usage of this string resource is not covered as it is in a class marked Obsolete.

* Reworded string resource Sch_InvalidAllMax to remove the invalid formatter.

* Added unit test for String Resource Sch_InvalidAllElementMax - invalid formatter.

* Reworded string resource Sch_InvalidAllElementMax to remove the invalid formatter.

* Added unit test which causes an XmlSchemaException using string resource Sch_InvalidExemplar as its message.

* Reworded Sch_InvalidExemplar to remove the invalid formatter.  Also, added the name of the element which cannot be used as the substitution group affiliation.

* Added unit test that causes an XmlSchemaException to be thrown using string resource Sch_GroupBaseRestNotEmptiable as its message.

* Removed the curly braces so there are no longer any invalid formatters.

* Added unit tests that cause an XmlSchemaException to be thrown using string resource Sch_AllRefMinMax as its message.

* Changed string resource Sch_AllRefMinMax to remove the invalid formatters.

* reworded Sch_MinLengthGtBaseMinLength and Sch_MaxLengthGtBaseMaxLength similarly to Sch_LengthGtBaseLength

* Corrected error "greater than" to "less than".

* Changed name of test to more accurately  reflect its purpose.

* Changed casing of MinLength and MaxLength to match their XML facets.  Removed redundant ToLower call and comment.

* Removed all Regex used to find invalid formatters.

* renamed MaxMinLengthBaseLength_TestData to indicate that this is testing the successful case.

* Removed suppression of exception so that we will see the exception if one is thrown.

* Removed comments as there are issues tracking these.

* Fixed comment larger -> lower.

* Removed XML comments on test methods.

* Removal of XML comment that was missed.
  • Loading branch information
mrj001 authored Apr 18, 2020
1 parent ddd458e commit 9e9543b
Show file tree
Hide file tree
Showing 4 changed files with 930 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/libraries/System.Private.Xml/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@
<value>It is an error for both length and minLength or maxLength to be present.</value>
</data>
<data name="Sch_MinLengthGtMaxLength" xml:space="preserve">
<value>MinLength is greater than MaxLength.</value>
<value>minLength is greater than maxLength.</value>
</data>
<data name="Sch_FractionDigitsGtTotalDigits" xml:space="preserve">
<value>FractionDigits is greater than TotalDigits.</value>
Expand Down Expand Up @@ -1396,7 +1396,7 @@
<value>'all' must have 'minOccurs' value of 0 or 1.</value>
</data>
<data name="Sch_InvalidAllMax" xml:space="preserve">
<value>'all' must have {max occurs}=1.</value>
<value>'all' must have a 'maxOccurs' value of 1.</value>
</data>
<data name="Sch_InvalidFacet" xml:space="preserve">
<value>The 'value' attribute must be present in facet.</value>
Expand Down Expand Up @@ -1501,7 +1501,7 @@
<value>Duplicate ID attribute.</value>
</data>
<data name="Sch_InvalidAllElementMax" xml:space="preserve">
<value>The {max occurs} of all the particles in the {particles} of an all group must be 0 or 1.</value>
<value>The 'maxOccurs' attribute of all the particles of an 'all' group must be 0 or 1.</value>
</data>
<data name="Sch_InvalidAny" xml:space="preserve">
<value>Invalid namespace in 'any'.</value>
Expand All @@ -1510,7 +1510,7 @@
<value>The value of the namespace attribute of the element or attribute wildcard is invalid - {0}</value>
</data>
<data name="Sch_InvalidExamplar" xml:space="preserve">
<value>Cannot be nominated as the {substitution group affiliation} of any other declaration.</value>
<value>Element '{0}' cannot be nominated as the 'substitutionGroup' of any other declaration.</value>
</data>
<data name="Sch_NoExamplar" xml:space="preserve">
<value>Reference to undeclared substitution group affiliation.</value>
Expand Down Expand Up @@ -1636,7 +1636,7 @@
<value>The derived particle cannot have more members than the base particle - All:All,Sequence:Sequence -- Recurse Rule 2 / Choice:Choice -- RecurseLax.</value>
</data>
<data name="Sch_GroupBaseRestNotEmptiable" xml:space="preserve">
<value>All particles in the {particles} of the base particle which are not mapped to by any particle in the {particles} of the derived particle should be emptiable - All:All,Sequence:Sequence -- Recurse Rule 2 / Choice:Choice -- RecurseLax.</value>
<value>All particles in the particles of the base particle which are not mapped to by any particle in the particles of the derived particle should be emptiable - All:All,Sequence:Sequence -- Recurse Rule 2 / Choice:Choice -- RecurseLax.</value>
</data>
<data name="Sch_SeqFromAll" xml:space="preserve">
<value>The derived sequence particle at ({0}, {1}) is not a valid restriction of the base all particle at ({2}, {3}) according to Sequence:All -- RecurseUnordered.</value>
Expand All @@ -1654,7 +1654,7 @@
<value>The group ref to 'all' is not the root particle, or it is being used as an extension.</value>
</data>
<data name="Sch_AllRefMinMax" xml:space="preserve">
<value>The group ref to 'all' must have {min occurs}= 0 or 1 and {max occurs}=1.</value>
<value>The group ref to 'all' must have 'minOccurs' = 0 or 1 and 'maxOccurs' = 1.</value>
</data>
<data name="Sch_NotAllAlone" xml:space="preserve">
<value>'all' is not the only particle in a group, or is being used as an extension.</value>
Expand Down Expand Up @@ -1720,16 +1720,16 @@
<value>Cannot load the schema from the location '{0}' - {1}</value>
</data>
<data name="Sch_LengthGtBaseLength" xml:space="preserve">
<value>It is an error if 'length' is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent 'length'.</value>
<value>It is an error if 'length' is among the members of the facets of the base type definition and its value is greater than the value of the parent 'length'.</value>
</data>
<data name="Sch_MinLengthGtBaseMinLength" xml:space="preserve">
<value>It is an error if 'minLength' is among the members of {facets} of {base type definition} and {value} is less than the {value} of the parent 'minLength'.</value>
<value>It is an error if 'minLength' is among the members of the facets of the base type definition and its value is less than the value of the parent 'minLength'.</value>
</data>
<data name="Sch_MaxLengthGtBaseMaxLength" xml:space="preserve">
<value>It is an error if 'maxLength' is among the members of {facets} of {base type definition} and {value} is greater than the {value} of the parent 'maxLength'.</value>
<value>It is an error if 'maxLength' is among the members of the facets of the base type definition and its value is greater than the value of the parent 'maxLength'.</value>
</data>
<data name="Sch_MaxMinLengthBaseLength" xml:space="preserve">
<value>It is an error for both 'length' and either 'minLength' or 'maxLength' to be members of {facets}, unless they are specified in different derivation steps. In which case the following must be true: the {value} of 'minLength' &lt;= the {value} of 'length' &lt;= the {value} of 'maxLength'.</value>
<value>It is an error for both 'length' and either 'minLength' or 'maxLength' to be members of facets, unless they are specified in different derivation steps. In which case the following must be true: the value of 'minLength' &lt;= the value of 'length' &lt;= the value of 'maxLength'.</value>
</data>
<data name="Sch_MaxInclusiveMismatch" xml:space="preserve">
<value>It is an error if the derived 'maxInclusive' facet value is greater than the parent 'maxInclusive' facet value.</value>
Expand Down Expand Up @@ -1768,7 +1768,7 @@
<value>It is an error if the derived 'fractionDigits' facet value is greater than the parent 'fractionDigits' facet value.</value>
</data>
<data name="Sch_FacetBaseFixed" xml:space="preserve">
<value>Values that are declared as {fixed} in a base type can not be changed in a derived type.</value>
<value>Values that are declared with fixed='true' in a base type can not be changed in a derived type.</value>
</data>
<data name="Sch_WhiteSpaceRestriction1" xml:space="preserve">
<value>It is an error if 'whiteSpace' is among the members of {facets} of {base type definition}, {value} is 'replace' or 'preserve', and the {value} of the parent 'whiteSpace' is 'collapse'.</value>
Expand Down Expand Up @@ -3456,4 +3456,4 @@ Usage: dotnet {0} [--assembly &lt;assembly file path&gt;] [--type &lt;type name&
<data name="CompilingScriptsNotSupported" xml:space="preserve">
<value>Compiling JScript/CSharp scripts is not supported</value>
</data>
</root>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ private void CompileSubstitutionGroup(XmlSchemaSubstitutionGroupV1Compat substit
{
if (examplar.FinalResolved == XmlSchemaDerivationMethod.All)
{
SendValidationEvent(SR.Sch_InvalidExamplar, examplar);
SendValidationEvent(SR.Sch_InvalidExamplar, examplar.Name, examplar);
}

for (int i = 0; i < substitutionGroup.Members.Count; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ private void CompileSubstitutionGroup(XmlSchemaSubstitutionGroup substitutionGro
{
if (examplar.FinalResolved == XmlSchemaDerivationMethod.All)
{
SendValidationEvent(SR.Sch_InvalidExamplar, examplar);
SendValidationEvent(SR.Sch_InvalidExamplar, examplar.Name, examplar);
}
//Build transitive members
ArrayList newMembers = null;
Expand Down
Loading

0 comments on commit 9e9543b

Please sign in to comment.