/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public override bool GetRequiredElements(ExpectedChildren result) { bool requiredElements = true; var requiredChoiceChildren = new ExpectedChildren(); // if there are any child elements that minOccurs = 0, then there is no requried children. if (this.ParticleConstraint.MinOccurs > 0) { foreach (var constraint in this.ParticleConstraint.ChildrenParticles) { if (!constraint.ParticleValidator.GetRequiredElements(requiredChoiceChildren)) { requiredElements = false; } } if (requiredElements && result != null) { result.Add(requiredChoiceChildren); } return(requiredElements); } else { return(false); } }
/// <summary> /// Add all expected children from another ExpectedChildren. /// </summary> /// <param name="expectedChildren"></param> internal void Add(ExpectedChildren expectedChildren) { if (expectedChildren._elementTypeIds != null && expectedChildren._elementTypeIds.Count > 0) { // No lock, not safe for multi-thread if (this._elementTypeIds == null) { this._elementTypeIds = new List <int>(); } foreach (var id in expectedChildren._elementTypeIds) { this._elementTypeIds.Add(id); } } if (expectedChildren._xsdanyNamespaces != null && expectedChildren._xsdanyNamespaces.Count > 0) { // No lock, not safe for multi-thread if (this._xsdanyNamespaces == null) { this._xsdanyNamespaces = new List <string>(); } foreach (var ns in expectedChildren._xsdanyNamespaces) { this._xsdanyNamespaces.Add(ns); } } }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <returns>Expected elements in this particle.</returns> public ExpectedChildren GetExpectedElements() { ExpectedChildren expectedElements = new ExpectedChildren(); expectedElements.Add(this.ElementId); return(expectedElements); }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <returns>Required elements in this particle.</returns> public ExpectedChildren GetRequiredElements() { ExpectedChildren requiredElements = new ExpectedChildren(); this.GetRequiredElements(requiredElements); return(requiredElements); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <returns>Expected elements in this particle.</returns> public ExpectedChildren GetExpectedElements() { ExpectedChildren expectedElements = new ExpectedChildren(); this.GetExpectedElements(expectedElements); return(expectedElements); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public virtual bool GetExpectedElements(ExpectedChildren result) { if (result != null) { result.Add(XsdAnyPrefidefinedValue.GetNamespaceString(this._particleConstraint.NamespaceValue)); } return(true); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { foreach (var constraint in this.ParticleConstraint.ChildrenParticles) { constraint.ParticleValidator.GetExpectedElements(result); } return(true); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { if (result != null) { result.Add(NamespaceIdMap.GetNamespaceUri(this._nsAnyParticleConstraint.NamespaceId)); } return(true); }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <returns>Required elements in this particle.</returns> public ExpectedChildren GetRequiredElements() { ExpectedChildren requiredElements = new ExpectedChildren(); if (this.MinOccurs > 0) { requiredElements.Add(this.ElementId); } return(requiredElements); }
/// <summary> /// The .ExpectedChildren will be non-null after this call. /// </summary> internal void InitExpectedChildren() { if (this.ExpectedChildren == null) { this.ExpectedChildren = new ExpectedChildren(); } else { this.ExpectedChildren.Clear(); } }
internal static string GetExpectedChildrenMessage(OpenXmlElement parent, ExpectedChildren expectedChildrenIds) { Debug.Assert(parent != null); if (expectedChildrenIds != null) { return(expectedChildrenIds.GetExpectedChildrenMessage(parent)); } return(string.Empty); }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public bool GetRequiredElements(ExpectedChildren result) { if (this.MinOccurs > 0) { if (result != null) { result.Add(this.ElementId); } return(true); } return(false); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { if (this.ParticleConstraint.ChildrenParticles.Length > 0) { // sequence, return only the first child. this.ParticleConstraint.ChildrenParticles[0].ParticleValidator.GetExpectedElements(result); return(true); } else { return(false); } }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public override bool GetRequiredElements(ExpectedChildren result) { bool requiredElements = false; if (this._particleConstraint.MinOccurs > 0) { foreach (var constraint in this._particleConstraint.ChildrenParticles) { if (constraint.ParticleValidator.GetRequiredElements(result)) { requiredElements = true; } } } return(requiredElements); }
/// <summary> /// Purpose: /// Resue this.ExpectedChildren data field. /// Avoid this.ExpectedChildren be referenced by more than one object (so "this.ExpectedChildren = other.ExpectedChildren" is not allowed). /// </summary> /// <param name="expectedChildren"></param> internal void SetExpectedChildren(ExpectedChildren expectedChildren) { if (expectedChildren == null || expectedChildren.Count == 0) { if (this.ExpectedChildren != null) { this.ExpectedChildren.Clear(); } // else, both are null, just return, nothing to do. } else { if (this.ExpectedChildren == null) { this.ExpectedChildren = new ExpectedChildren(); } this.ExpectedChildren.Clear(); this.ExpectedChildren.Add(expectedChildren); } }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public virtual bool GetExpectedElements(ExpectedChildren result) { if (result != null) { result.Add(XsdAnyPrefidefinedValue.GetNamespaceString(this._particleConstraint.NamespaceValue)); } return true; }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public override bool GetRequiredElements(ExpectedChildren result) { bool requiredElements = true; var requiredChoiceChildren = new ExpectedChildren(); // if there are any child elements that minOccurs = 0, then there is no requried children. if (this.ParticleConstraint.MinOccurs > 0) { foreach (var constraint in this.ParticleConstraint.ChildrenParticles) { if (!constraint.ParticleValidator.GetRequiredElements(requiredChoiceChildren)) { requiredElements = false; } } if (requiredElements && result != null) { result.Add(requiredChoiceChildren); } return requiredElements; } else { return false; } }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public virtual bool GetRequiredElements(ExpectedChildren result) { return(false); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { if (this.ParticleConstraint.ChildrenParticles.Length > 0) { // sequence, return only the first child. this.ParticleConstraint.ChildrenParticles[0].ParticleValidator.GetExpectedElements(result); return true; } else { return false; } }
internal static string GetExpectedChildrenMessage(OpenXmlElement parent, ExpectedChildren expectedChildrenIds) { Debug.Assert(parent != null); if (expectedChildrenIds != null) { return expectedChildrenIds.GetExpectedChildrenMessage(parent); } return string.Empty; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { foreach (var constraint in this.ParticleConstraint.ChildrenParticles) { constraint.ParticleValidator.GetExpectedElements(result); } return true; }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public bool GetRequiredElements(ExpectedChildren result) { if (this.MinOccurs > 0) { if (result != null) { result.Add(this.ElementId); } return true; } return false; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public override bool GetExpectedElements(ExpectedChildren result) { if (result != null) { result.Add(NamespaceIdMap.GetNamespaceUri(this._nsAnyParticleConstraint.NamespaceId)); } return true; }
// TODO: do better job for simple sequence ( children are elements only ). /// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are required elements in this particle.</returns> public override bool GetRequiredElements(ExpectedChildren result) { bool requiredElements = false; if (this.ParticleConstraint.MinOccurs > 0) { foreach (var constraint in this.ParticleConstraint.ChildrenParticles) { if (constraint.ParticleValidator.GetRequiredElements(result)) { requiredElements = true; break; // return the first required element in sequence. } } } return requiredElements; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public virtual bool GetExpectedElements(ExpectedChildren result) { return false; }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <returns>Required elements in this particle.</returns> public ExpectedChildren GetRequiredElements() { ExpectedChildren requiredElements = new ExpectedChildren(); this.GetRequiredElements(requiredElements); return requiredElements; }
/// <summary> /// Get the required elements - elements which minOccurs > 0. /// </summary> /// <returns>Required elements in this particle.</returns> public ExpectedChildren GetRequiredElements() { ExpectedChildren requiredElements = new ExpectedChildren(); if (this.MinOccurs > 0) { requiredElements.Add(this.ElementId); } return requiredElements; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public bool GetExpectedElements(ExpectedChildren result) { result.Add(this.ElementId); return(true); }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <param name="result"></param> /// <returns>True if there are expected elements in this particle.</returns> public bool GetExpectedElements(ExpectedChildren result) { result.Add(this.ElementId); return true; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <returns>Expected elements in this particle.</returns> public ExpectedChildren GetExpectedElements() { ExpectedChildren expectedElements = new ExpectedChildren(); this.GetExpectedElements(expectedElements); return expectedElements; }
/// <summary> /// Get the expected elements - elements which minOccurs >= 0. /// </summary> /// <returns>Expected elements in this particle.</returns> public ExpectedChildren GetExpectedElements() { ExpectedChildren expectedElements = new ExpectedChildren(); expectedElements.Add(this.ElementId); return expectedElements; }