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 override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet) { ArrayList particles = new ArrayList(); foreach (DictionaryEntry entry in this.elements) { if (!context.AllElementsSet[(int)entry.Value] && (!isRequiredOnly || this.isRequired[(int)entry.Value])) { ContentValidator.AddParticleToExpected(this.particles[(int)entry.Value] as XmlSchemaParticle, schemaSet, particles); } } return(particles); }
public override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet) { ArrayList particles = new ArrayList(); BitSet set = context.CurPos[context.CurrentState.CurPosIndex]; for (int i = set.NextSet(-1); i != -1; i = set.NextSet(i)) { XmlSchemaParticle p = (XmlSchemaParticle)this.positions[i].particle; if (p != null) { ContentValidator.AddParticleToExpected(p, schemaSet, particles); } } return(particles); }
private static XmlSchemaComplexType CreateAnyType(XmlSchemaContentProcessing processContents) { XmlSchemaComplexType localAnyType = new XmlSchemaComplexType(); localAnyType.SetQualifiedName(DatatypeImplementation.QnAnyType); XmlSchemaAny anyElement = new XmlSchemaAny(); anyElement.MinOccurs = decimal.Zero; anyElement.MaxOccurs = decimal.MaxValue; anyElement.ProcessContents = processContents; anyElement.BuildNamespaceList(null); XmlSchemaSequence seq = new XmlSchemaSequence(); seq.Items.Add(anyElement); localAnyType.SetContentTypeParticle(seq); localAnyType.SetContentType(XmlSchemaContentType.Mixed); localAnyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl(); localAnyType.ElementDecl.SchemaType = localAnyType; //Create contentValidator for Any ParticleContentValidator contentValidator = new ParticleContentValidator(XmlSchemaContentType.Mixed); contentValidator.Start(); contentValidator.OpenGroup(); contentValidator.AddNamespaceList(anyElement.NamespaceList !, anyElement); contentValidator.AddStar(); contentValidator.CloseGroup(); ContentValidator anyContentValidator = contentValidator.Finish(true); localAnyType.ElementDecl.ContentValidator = anyContentValidator; XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute(); anyAttribute.ProcessContents = processContents; anyAttribute.BuildNamespaceList(null); localAnyType.SetAttributeWildcard(anyAttribute); localAnyType.ElementDecl.AnyAttribute = anyAttribute; return(localAnyType); }
public override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet) { ArrayList particles = new ArrayList(); int[] numArray = this.transitionTable[context.CurrentState.State]; if (numArray != null) { for (int i = 0; i < (numArray.Length - 1); i++) { if (numArray[i] != -1) { XmlSchemaParticle p = (XmlSchemaParticle)this.symbols.GetParticle(i); if (p != null) { ContentValidator.AddParticleToExpected(p, schemaSet, particles); } } } } return(particles); }
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) });
internal SchemaElementDecl(XmlSchemaDatatype dtype) { Datatype = dtype; _contentValidator = ContentValidator.TextOnly; }
internal SchemaElementDecl(XmlSchemaDatatype dtype) { Datatype = dtype; contentValidator = ContentValidator.TextOnly; }
public ContentIterator(XPathNode nd, Shape shape) { this.node = nd; XmlSchemaElement xse = shape.XmlSchemaElement; Debug.Assert(null != xse); SchemaElementDecl decl = xse.ElementDecl; Debug.Assert(null != decl); this.contentValidator = decl.ContentValidator; this.currentState = new ValidationState(); this.contentValidator.InitValidation(this.currentState); this.currentState.ProcessContents = XmlSchemaContentProcessing.Strict; if (nd != null) Advance(); }