ExpectedElements() public méthode

public ExpectedElements ( ValidationState context, bool isRequiredOnly ) : ArrayList
context ValidationState
isRequiredOnly bool
Résultat System.Collections.ArrayList
Exemple #1
0
 public void ValidateText()
 {
     if (context.NeedValidateChildren)
     {
         if (context.IsNill)
         {
             SendValidationEvent(SR.Sch_ContentInNill, XmlSchemaValidator.QNameString(context.LocalName, context.Namespace));
             return;
         }
         ContentValidator     contentValidator = context.ElementDecl.ContentValidator;
         XmlSchemaContentType contentType      = contentValidator.ContentType;
         if (contentType == XmlSchemaContentType.ElementOnly)
         {
             ArrayList names = contentValidator.ExpectedElements(context, false);
             if (names == null)
             {
                 SendValidationEvent(SR.Sch_InvalidTextInElement, XmlSchemaValidator.BuildElementName(context.LocalName, context.Namespace));
             }
             else
             {
                 Debug.Assert(names.Count > 0);
                 SendValidationEvent(SR.Sch_InvalidTextInElementExpecting, new string[] { XmlSchemaValidator.BuildElementName(context.LocalName, context.Namespace), XmlSchemaValidator.PrintExpectedElements(names, false) });
             }
         }
         else if (contentType == XmlSchemaContentType.Empty)
         {
             SendValidationEvent(SR.Sch_InvalidTextInEmpty, string.Empty);
         }
         if (checkDatatype)
         {
             SaveTextValue(reader.Value);
         }
     }
 }
        public void ValidateText()
        {
            if (this.context.NeedValidateChildren)
            {
                if (this.context.IsNill)
                {
                    this.SendValidationEvent("Sch_ContentInNill", XmlSchemaValidator.QNameString(this.context.LocalName, this.context.Namespace));
                }
                else
                {
                    ContentValidator contentValidator = this.context.ElementDecl.ContentValidator;
                    switch (contentValidator.ContentType)
                    {
                    case XmlSchemaContentType.ElementOnly:
                    {
                        ArrayList expected = contentValidator.ExpectedElements(this.context, false);
                        if (expected == null)
                        {
                            this.SendValidationEvent("Sch_InvalidTextInElement", XmlSchemaValidator.BuildElementName(this.context.LocalName, this.context.Namespace));
                        }
                        else
                        {
                            this.SendValidationEvent("Sch_InvalidTextInElementExpecting", new string[] { XmlSchemaValidator.BuildElementName(this.context.LocalName, this.context.Namespace), XmlSchemaValidator.PrintExpectedElements(expected, false) });
                        }
                        break;
                    }

                    case XmlSchemaContentType.Empty:
                        this.SendValidationEvent("Sch_InvalidTextInEmpty", string.Empty);
                        break;
                    }
                    if (this.checkDatatype)
                    {
                        this.SaveTextValue(this.reader.Value);
                    }
                }
            }
        }
        public void ValidateText()
        {
            Debug.Assert(context != null);
            if (context.NeedValidateChildren)
            {
                if (context.IsNill)
                {
                    SendValidationEvent(SR.Sch_ContentInNill, XmlSchemaValidator.QNameString(context.LocalName !, context.Namespace !));
                    return;
                }

                ContentValidator     contentValidator = context.ElementDecl !.ContentValidator !;
                XmlSchemaContentType contentType      = contentValidator.ContentType;
                if (contentType == XmlSchemaContentType.ElementOnly)
                {
                    ArrayList?names = contentValidator.ExpectedElements(context, false);
                    if (names == null)
                    {
                        SendValidationEvent(SR.Sch_InvalidTextInElement, XmlSchemaValidator.BuildElementName(context.LocalName !, context.Namespace !));
                    }
                    else
                    {
                        Debug.Assert(names.Count > 0);
                        SendValidationEvent(SR.Sch_InvalidTextInElementExpecting, new string[] { XmlSchemaValidator.BuildElementName(context.LocalName !, context.Namespace !), XmlSchemaValidator.PrintExpectedElements(names, false) });