System.Xml.Schema.FacetsChecker.FacetsCompiler.CompileWhitespaceFacet C# (CSharp) Méthode

CompileWhitespaceFacet() private méthode

private CompileWhitespaceFacet ( XmlSchemaFacet facet ) : void
facet XmlSchemaFacet
Résultat void
        internal void CompileWhitespaceFacet(XmlSchemaFacet facet) {
            CheckProhibitedFlag(facet, RestrictionFlags.WhiteSpace, Res.Sch_WhiteSpaceFacetProhibited);
            CheckDupFlag(facet, RestrictionFlags.WhiteSpace, Res.Sch_DupWhiteSpaceFacet);
            if (facet.Value == "preserve") {
                derivedRestriction.WhiteSpace = XmlSchemaWhiteSpace.Preserve;
            }
            else if (facet.Value == "replace") {
                derivedRestriction.WhiteSpace = XmlSchemaWhiteSpace.Replace;
            }
            else if (facet.Value == "collapse") {
                derivedRestriction.WhiteSpace = XmlSchemaWhiteSpace.Collapse;
            }
            else {
                throw new XmlSchemaException(Res.Sch_InvalidWhiteSpace, facet.Value, facet);
            }
            if ((baseFixedFlags & RestrictionFlags.WhiteSpace) != 0) {
                if (!datatype.IsEqual(datatype.Restriction.WhiteSpace, derivedRestriction.WhiteSpace)) {
                    throw new XmlSchemaException(Res.Sch_FacetBaseFixed, facet);
                }
            }
            //Check base and derived whitespace facets
            XmlSchemaWhiteSpace baseWhitespace;
            if ((baseFlags & RestrictionFlags.WhiteSpace) != 0) {
                baseWhitespace = datatype.Restriction.WhiteSpace;
            }
            else {
                baseWhitespace = datatype.BuiltInWhitespaceFacet;
            }
            if ( baseWhitespace == XmlSchemaWhiteSpace.Collapse &&
                (derivedRestriction.WhiteSpace == XmlSchemaWhiteSpace.Replace || derivedRestriction.WhiteSpace == XmlSchemaWhiteSpace.Preserve)
            ) {
                throw new XmlSchemaException(Res.Sch_WhiteSpaceRestriction1, facet);
            }
            if (baseWhitespace == XmlSchemaWhiteSpace.Replace &&
                derivedRestriction.WhiteSpace == XmlSchemaWhiteSpace.Preserve
            ) {
                throw new XmlSchemaException(Res.Sch_WhiteSpaceRestriction2, facet);
            }
            SetFlag(facet, RestrictionFlags.WhiteSpace);
        }