本文整理汇总了C#中System.Xml.Schema.XmlSchemaParticle类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaParticle类的具体用法?C# XmlSchemaParticle怎么用?C# XmlSchemaParticle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaParticle类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaParticle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Get
public XsdValidationState Get (XmlSchemaParticle xsobj)
{
XsdValidationState got = table [xsobj] as XsdValidationState;
if (got == null)
got = Create (xsobj);
return got;
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:XsdParticleValidationState.cs
示例2: BuildParticleContentModel
private bool BuildParticleContentModel(ParticleContentValidator contentValidator, XmlSchemaParticle particle)
{
bool flag = false;
if (particle is XmlSchemaElement)
{
XmlSchemaElement element = (XmlSchemaElement) particle;
contentValidator.AddName(element.QualifiedName, element);
}
else if (particle is XmlSchemaAny)
{
flag = true;
XmlSchemaAny any = (XmlSchemaAny) particle;
contentValidator.AddNamespaceList(any.NamespaceList, any);
}
else if (particle is XmlSchemaGroupBase)
{
XmlSchemaObjectCollection items = ((XmlSchemaGroupBase) particle).Items;
bool flag2 = particle is XmlSchemaChoice;
contentValidator.OpenGroup();
bool flag3 = true;
for (int i = 0; i < items.Count; i++)
{
if (flag3)
{
flag3 = false;
}
else if (flag2)
{
contentValidator.AddChoice();
}
else
{
contentValidator.AddSequence();
}
flag = this.BuildParticleContentModel(contentValidator, (XmlSchemaParticle) items[i]);
}
contentValidator.CloseGroup();
}
if ((particle.MinOccurs != 1M) || (particle.MaxOccurs != 1M))
{
if ((particle.MinOccurs == 0M) && (particle.MaxOccurs == 1M))
{
contentValidator.AddQMark();
return flag;
}
if ((particle.MinOccurs == 0M) && (particle.MaxOccurs == 79228162514264337593543950335M))
{
contentValidator.AddStar();
return flag;
}
if ((particle.MinOccurs == 1M) && (particle.MaxOccurs == 79228162514264337593543950335M))
{
contentValidator.AddPlus();
return flag;
}
contentValidator.AddLeafRange(particle.MinOccurs, particle.MaxOccurs);
}
return flag;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:59,代码来源:Compiler.cs
示例3: ClearCompiledState
private void ClearCompiledState()
{
this.attributeUses = null;
this.localElements = null;
this.attributeWildcard = null;
this.contentTypeParticle = XmlSchemaParticle.Empty;
this.blockResolved = XmlSchemaDerivationMethod.None;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlSchemaComplexType.cs
示例4: InsertElement
/// <summary>
/// Insert an element above an existing any item.
/// </summary>
/// <param name="particle">The particle in which the any item should be found.</param>
/// <param name="element">The element to insert.</param>
/// <returns>true if the element was inserted; false otherwise.</returns>
private bool InsertElement(XmlSchemaParticle particle, XmlSchemaElement element)
{
if (particle is XmlSchemaChoice)
{
XmlSchemaChoice choice = (XmlSchemaChoice)particle;
for (int i = 0; i < choice.Items.Count; i++)
{
XmlSchemaParticle childParticle = (XmlSchemaParticle)choice.Items[i];
if (childParticle is XmlSchemaAny)
{
// index this any element for later removal
this.anys[childParticle] = choice;
choice.Items.Insert(i, element);
return true;
}
else
{
if (this.InsertElement(childParticle, element))
{
return true;
}
}
}
}
else if (particle is XmlSchemaSequence)
{
XmlSchemaSequence sequence = (XmlSchemaSequence)particle;
for (int i = 0; i < sequence.Items.Count; i++)
{
XmlSchemaParticle childParticle = (XmlSchemaParticle)sequence.Items[i];
if (childParticle is XmlSchemaAny)
{
// index this any element for later removal
this.anys[childParticle] = sequence;
sequence.Items.Insert(i, element);
return true;
}
else
{
if (this.InsertElement(childParticle, element))
{
return true;
}
}
}
}
return false;
}
开发者ID:zooba,项目名称:wix3,代码行数:61,代码来源:XsdStitch.cs
示例5: GetAlternativesFromParticle
public static IEnumerable<XmlSchemaElement> GetAlternativesFromParticle(XmlSchemaParticle particle)
{
if (particle is XmlSchemaElement)
{
yield return particle as XmlSchemaElement;
yield break;
}
XmlSchemaParticle result;
XmlSchemaSequence seq = particle as XmlSchemaSequence;
if (seq != null)
{
foreach (XmlSchemaObject o in seq.Items)
{
result = o as XmlSchemaParticle;
if (result != null)
{
foreach (XmlSchemaElement el in GetAlternativesFromParticle(result))
{
yield return el;
}
}
}
}
XmlSchemaChoice ch = particle as XmlSchemaChoice;
if (ch != null)
{
foreach (XmlSchemaObject a in ch.Items)
{
result = a as XmlSchemaParticle;
if (result != null)
{
foreach (XmlSchemaElement el2 in GetAlternativesFromParticle(result))
{
yield return el2;
}
}
}
}
}
开发者ID:Ju2ender,项目名称:csharp-e,代码行数:42,代码来源:Schema.cs
示例6: ParticleEquals
internal override bool ParticleEquals (XmlSchemaParticle other)
{
XmlSchemaGroupBase gb = other as XmlSchemaGroupBase;
if (gb == null)
return false;
if (this.GetType () != gb.GetType ())
return false;
if (this.ValidatedMaxOccurs != gb.ValidatedMaxOccurs ||
this.ValidatedMinOccurs != gb.ValidatedMinOccurs)
return false;
if (this.CompiledItems.Count != gb.CompiledItems.Count)
return false;
for (int i = 0; i < CompiledItems.Count; i++) {
XmlSchemaParticle p1 = this.CompiledItems [i] as XmlSchemaParticle;
XmlSchemaParticle p2 = gb.CompiledItems [i] as XmlSchemaParticle;
if (!p1.ParticleEquals (p2))
return false;
}
return true;
}
开发者ID:nobled,项目名称:mono,代码行数:21,代码来源:XmlSchemaGroupBase.cs
示例7: AddParticleToExpected
public static void AddParticleToExpected(XmlSchemaParticle p, XmlSchemaSet schemaSet, ArrayList particles, bool global)
{
if (!particles.Contains(p))
{
particles.Add(p);
}
XmlSchemaElement element = p as XmlSchemaElement;
if ((element != null) && (global || !element.RefName.IsEmpty))
{
XmlSchemaSubstitutionGroup group = (XmlSchemaSubstitutionGroup) schemaSet.SubstitutionGroups[element.QualifiedName];
if (group != null)
{
for (int i = 0; i < group.Members.Count; i++)
{
XmlSchemaElement item = (XmlSchemaElement) group.Members[i];
if (!element.QualifiedName.Equals(item.QualifiedName) && !particles.Contains(item))
{
particles.Add(item);
}
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ContentValidator.cs
示例8: CopyInfo
// This method is used only by particles
internal virtual void CopyInfo (XmlSchemaParticle obj)
{
obj.LineNumber = LineNumber;
obj.LinePosition = LinePosition;
obj.SourceUri = SourceUri;
obj.errorCount = errorCount;
// Other fields and properties may be useless for Particle.
}
开发者ID:user277,项目名称:mono,代码行数:9,代码来源:XmlSchemaObject.cs
示例9: findElement
/// <summary>
/// Finds the element specified in the given stack, starting from the given XML particle.
/// </summary>
/// <param name="p_xspParticle">The particle at which to being the search.</param>
/// <param name="p_stkCode">A stack describing a path to an XML element.</param>
/// <returns>The element specified by the given stack, or <lang cref="null"/> if no such
/// element could be found.</returns>
private XmlSchemaElement findElement(XmlSchemaParticle p_xspParticle, Stack<string> p_stkCode)
{
if (p_xspParticle is XmlSchemaElement)
{
XmlSchemaElement xseElement = (XmlSchemaElement)p_xspParticle;
if (p_stkCode.Peek().Equals(xseElement.Name))
{
p_stkCode.Pop();
if (p_stkCode.Count == 0)
return xseElement;
if (xseElement.ElementSchemaType is XmlSchemaComplexType)
{
XmlSchemaComplexType xctElement = (XmlSchemaComplexType)xseElement.ElementSchemaType;
if (xctElement.ContentTypeParticle != null)
return findElement(xctElement.ContentTypeParticle, p_stkCode);
}
//if this isn't a complex type, then this element has no children,
// so if this isn't the element we are looking for, we are looking
// in the wrong part of the schema tree.
}
}
else if (p_xspParticle is XmlSchemaGroupBase)
{
//this handle sequences, choices, and all
XmlSchemaGroupBase xbsGroup = (XmlSchemaGroupBase)p_xspParticle;
XmlSchemaElement xseElement = null;
foreach (XmlSchemaParticle xspParticle in xbsGroup.Items)
{
xseElement = findElement(xspParticle, p_stkCode);
if (xseElement != null)
return xseElement;
}
}
return null;
}
开发者ID:BioBrainX,项目名称:fomm,代码行数:44,代码来源:XmlCompletionProvider.cs
示例10: CalculateEffectiveTotalRange
private void CalculateEffectiveTotalRange(XmlSchemaParticle particle, out decimal minOccurs, out decimal maxOccurs)
{
if ((particle is XmlSchemaElement) || (particle is XmlSchemaAny))
{
minOccurs = particle.MinOccurs;
maxOccurs = particle.MaxOccurs;
}
else if (particle is XmlSchemaChoice)
{
if (((XmlSchemaChoice) particle).Items.Count == 0)
{
minOccurs = maxOccurs = 0M;
}
else
{
minOccurs = 79228162514264337593543950335M;
maxOccurs = 0M;
XmlSchemaChoice choice = (XmlSchemaChoice) particle;
for (int i = 0; i < choice.Items.Count; i++)
{
decimal num2;
decimal num3;
this.CalculateEffectiveTotalRange((XmlSchemaParticle) choice.Items[i], out num2, out num3);
if (num2 < minOccurs)
{
minOccurs = num2;
}
if (num3 > maxOccurs)
{
maxOccurs = num3;
}
}
minOccurs *= particle.MinOccurs;
if (maxOccurs != 79228162514264337593543950335M)
{
if (particle.MaxOccurs == 79228162514264337593543950335M)
{
maxOccurs = 79228162514264337593543950335M;
}
else
{
maxOccurs *= particle.MaxOccurs;
}
}
}
}
else
{
XmlSchemaObjectCollection items = ((XmlSchemaGroupBase) particle).Items;
if (items.Count == 0)
{
minOccurs = maxOccurs = 0M;
}
else
{
minOccurs = 0M;
maxOccurs = 0M;
for (int j = 0; j < items.Count; j++)
{
decimal num5;
decimal num6;
this.CalculateEffectiveTotalRange((XmlSchemaParticle) items[j], out num5, out num6);
minOccurs += num5;
if (maxOccurs != 79228162514264337593543950335M)
{
if (num6 == 79228162514264337593543950335M)
{
maxOccurs = 79228162514264337593543950335M;
}
else
{
maxOccurs += num6;
}
}
}
minOccurs *= particle.MinOccurs;
if (maxOccurs != 79228162514264337593543950335M)
{
if (particle.MaxOccurs == 79228162514264337593543950335M)
{
maxOccurs = 79228162514264337593543950335M;
}
else
{
maxOccurs *= particle.MaxOccurs;
}
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:90,代码来源:SchemaCollectionCompiler.cs
示例11: CannonicalizeParticle
private XmlSchemaParticle CannonicalizeParticle(XmlSchemaParticle particle, bool root, bool substitution)
{
if ((particle == null) || particle.IsEmpty)
{
return XmlSchemaParticle.Empty;
}
if (particle is XmlSchemaElement)
{
return this.CannonicalizeElement((XmlSchemaElement) particle, substitution);
}
if (particle is XmlSchemaGroupRef)
{
return this.CannonicalizeGroupRef((XmlSchemaGroupRef) particle, root, substitution);
}
if (particle is XmlSchemaAll)
{
return this.CannonicalizeAll((XmlSchemaAll) particle, root, substitution);
}
if (particle is XmlSchemaChoice)
{
return this.CannonicalizeChoice((XmlSchemaChoice) particle, root, substitution);
}
if (particle is XmlSchemaSequence)
{
return this.CannonicalizeSequence((XmlSchemaSequence) particle, root, substitution);
}
return particle;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:SchemaCollectionCompiler.cs
示例12: IsValidOccurrenceRangeRestriction
private bool IsValidOccurrenceRangeRestriction(XmlSchemaParticle derivedParticle, XmlSchemaParticle baseParticle)
{
return this.IsValidOccurrenceRangeRestriction(derivedParticle.MinOccurs, derivedParticle.MaxOccurs, baseParticle.MinOccurs, baseParticle.MaxOccurs);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:SchemaCollectionCompiler.cs
示例13: GetSchemaContentType
private XmlSchemaContentType GetSchemaContentType(XmlSchemaComplexType complexType, XmlSchemaComplexContent complexContent, XmlSchemaParticle particle)
{
if (((complexContent != null) && complexContent.IsMixed) || ((complexContent == null) && complexType.IsMixed))
{
return XmlSchemaContentType.Mixed;
}
if ((particle != null) && !particle.IsEmpty)
{
return XmlSchemaContentType.ElementOnly;
}
return XmlSchemaContentType.Empty;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:SchemaCollectionCompiler.cs
示例14: CanBeArray
bool CanBeArray (XmlQualifiedName typeQName, XmlSchemaParticle particle, bool multiValue)
{
// To be an array, there can't be a direct child of type typeQName
if (particle == null) return false;
multiValue = multiValue || particle.MaxOccurs > 1;
if (particle is XmlSchemaGroupRef)
return CanBeArray (typeQName, GetRefGroupParticle ((XmlSchemaGroupRef)particle), multiValue);
if (particle is XmlSchemaElement)
{
XmlSchemaElement elem = (XmlSchemaElement)particle;
if (!elem.RefName.IsEmpty)
return CanBeArray (typeQName, FindRefElement (elem), multiValue);
else
return multiValue && !typeQName.Equals (((XmlSchemaElement)particle).SchemaTypeName);
}
if (particle is XmlSchemaAny)
return multiValue;
if (particle is XmlSchemaSequence)
{
XmlSchemaSequence seq = particle as XmlSchemaSequence;
if (seq.Items.Count != 1) return false;
return CanBeArray (typeQName, (XmlSchemaParticle)seq.Items[0], multiValue);
}
if (particle is XmlSchemaChoice)
{
// Can be array if all choices have different types
ArrayList types = new ArrayList ();
if(!CheckChoiceType (typeQName, particle, types, ref multiValue)) return false;
return multiValue;
}
return false;
}
开发者ID:nestalk,项目名称:mono,代码行数:40,代码来源:XmlSchemaImporter.cs
示例15: ImportGroupMembers
void ImportGroupMembers(XmlSchemaParticle particle, CodeIdentifiers members, string ns) {
XmlQualifiedName parentType = XmlSchemas.GetParentName(particle);
if (particle is XmlSchemaGroupRef) {
throw new InvalidOperationException(Res.GetString(Res.XmlSoapUnsupportedGroupRef, parentType.Name, parentType.Namespace));
}
else if (particle is XmlSchemaGroupBase) {
XmlSchemaGroupBase group = (XmlSchemaGroupBase)particle;
if (group.IsMultipleOccurrence)
throw new InvalidOperationException(Res.GetString(Res.XmlSoapUnsupportedGroupRepeat, parentType.Name, parentType.Namespace));
for (int i = 0; i < group.Items.Count; i++) {
object item = group.Items[i];
if (item is XmlSchemaGroupBase || item is XmlSchemaGroupRef)
throw new InvalidOperationException(Res.GetString(Res.XmlSoapUnsupportedGroupNested, parentType.Name, parentType.Namespace));
else if (item is XmlSchemaElement)
ImportElementMember((XmlSchemaElement)item, members, ns);
else if (item is XmlSchemaAny)
throw new InvalidOperationException(Res.GetString(Res.XmlSoapUnsupportedGroupAny, parentType.Name, parentType.Namespace));
}
}
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:soapschemaimporter.cs
示例16: CompileParticleElements
private void CompileParticleElements(XmlSchemaComplexType complexType, XmlSchemaParticle particle)
{
if (particle is XmlSchemaElement)
{
XmlSchemaElement xe = (XmlSchemaElement) particle;
this.CompileElement(xe);
if (complexType.LocalElements[xe.QualifiedName] == null)
{
complexType.LocalElements.Add(xe.QualifiedName, xe);
}
else
{
XmlSchemaElement element2 = (XmlSchemaElement) complexType.LocalElements[xe.QualifiedName];
if (element2.ElementSchemaType != xe.ElementSchemaType)
{
base.SendValidationEvent("Sch_ElementTypeCollision", particle);
}
}
}
else if (particle is XmlSchemaGroupBase)
{
XmlSchemaObjectCollection items = ((XmlSchemaGroupBase) particle).Items;
for (int i = 0; i < items.Count; i++)
{
this.CompileParticleElements(complexType, (XmlSchemaParticle) items[i]);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:SchemaCollectionCompiler.cs
示例17: GetMappingParticle
private int GetMappingParticle(XmlSchemaParticle particle, XmlSchemaObjectCollection collection)
{
for (int i = 0; i < collection.Count; i++)
{
if (this.IsValidRestriction(particle, (XmlSchemaParticle) collection[i]))
{
return i;
}
}
return -1;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SchemaCollectionCompiler.cs
示例18: CheckChoiceType
bool CheckChoiceType (XmlQualifiedName typeQName, XmlSchemaParticle particle, ArrayList types, ref bool multiValue)
{
XmlQualifiedName type = null;
multiValue = multiValue || particle.MaxOccurs > 1;
if (particle is XmlSchemaGroupRef)
return CheckChoiceType (typeQName, GetRefGroupParticle ((XmlSchemaGroupRef)particle), types, ref multiValue);
if (particle is XmlSchemaElement) {
string ns;
XmlSchemaElement elem = (XmlSchemaElement)particle;
XmlSchemaElement refElem = GetRefElement (typeQName, elem, out ns);
if (refElem.SchemaType != null) return true;
type = refElem.SchemaTypeName;
}
else if (particle is XmlSchemaAny) {
type = anyType;
}
else if (particle is XmlSchemaSequence)
{
XmlSchemaSequence seq = particle as XmlSchemaSequence;
foreach (XmlSchemaParticle par in seq.Items)
if (!CheckChoiceType (typeQName, par, types, ref multiValue)) return false;
return true;
}
else if (particle is XmlSchemaChoice)
{
foreach (XmlSchemaParticle choice in ((XmlSchemaChoice)particle).Items)
if (!CheckChoiceType (typeQName, choice, types, ref multiValue)) return false;
return true;
}
if (typeQName.Equals (type)) return false;
// For primitive types, compare using CLR types, since several
// xml types can be mapped to a single CLR type
string t;
if (IsPrimitiveTypeNamespace (type.Namespace))
t = TypeTranslator.GetPrimitiveTypeData (type.Name).FullTypeName + ":" + type.Namespace;
else
t = type.Name + ":" + type.Namespace;
if (types.Contains (t)) return false;
types.Add (t);
return true;
}
开发者ID:nestalk,项目名称:mono,代码行数:49,代码来源:XmlSchemaImporter.cs
示例19: IsParticleEmptiable
private bool IsParticleEmptiable(XmlSchemaParticle particle)
{
decimal num;
decimal num2;
this.CalculateEffectiveTotalRange(particle, out num, out num2);
return (num == 0M);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SchemaCollectionCompiler.cs
示例20: ImportParticleComplexContent
void ImportParticleComplexContent (XmlQualifiedName typeQName, ClassMap cmap, XmlSchemaParticle particle, CodeIdentifiers classIds, bool isMixed)
{
ImportParticleContent (typeQName, cmap, particle, classIds, false, ref isMixed);
if (isMixed) AddTextMember (typeQName, cmap, classIds);
}
开发者ID:nestalk,项目名称:mono,代码行数:5,代码来源:XmlSchemaImporter.cs
注:本文中的System.Xml.Schema.XmlSchemaParticle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论