当前位置: 首页>>代码示例>>C#>>正文


C# XmlSchemaParticle.Clone方法代码示例

本文整理汇总了C#中System.Xml.Schema.XmlSchemaParticle.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaParticle.Clone方法的具体用法?C# XmlSchemaParticle.Clone怎么用?C# XmlSchemaParticle.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Schema.XmlSchemaParticle的用法示例。


在下文中一共展示了XmlSchemaParticle.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloneParticle

        internal static XmlSchemaParticle CloneParticle(XmlSchemaParticle particle) {
            XmlSchemaGroupBase groupBase = particle as XmlSchemaGroupBase;
            if (groupBase != null && ! (groupBase is XmlSchemaAll)) { //Choice or sequence
                XmlSchemaGroupBase newGroupBase = groupBase;

                XmlSchemaObjectCollection newGroupbaseParticles = CloneGroupBaseParticles(groupBase.Items);
                newGroupBase = (XmlSchemaGroupBase)groupBase.Clone();
                newGroupBase.SetItems(newGroupbaseParticles);
                return newGroupBase;
            }
            else if (particle is XmlSchemaGroupRef) { // group ref
                XmlSchemaGroupRef newGroupRef = (XmlSchemaGroupRef)particle.Clone();
                newGroupRef.RefName = newGroupRef.RefName.Clone();
                return newGroupRef;
            }
            else {
                XmlSchemaElement oldElem = particle as XmlSchemaElement;
                if (oldElem != null && (!oldElem.RefName.IsEmpty || !oldElem.SchemaTypeName.IsEmpty)) { //Its element ref or type name is present
                    XmlSchemaElement newElem = (XmlSchemaElement)oldElem.Clone();
                    return newElem;
                }
            }
            return particle;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:24,代码来源:xmlschemacomplextype.cs

示例2: CloneParticle

        internal static XmlSchemaParticle CloneParticle(XmlSchemaParticle particle, XmlSchema parentSchema) {
            XmlSchemaGroupBase groupBase = particle as XmlSchemaGroupBase;
            if (groupBase != null) { //Choice or sequence
                XmlSchemaGroupBase newGroupBase = groupBase;

                XmlSchemaObjectCollection newGroupbaseParticles = CloneGroupBaseParticles(groupBase.Items, parentSchema);
                newGroupBase = (XmlSchemaGroupBase)groupBase.Clone();
                newGroupBase.SetItems(newGroupbaseParticles);
                return newGroupBase;
            }
            else if (particle is XmlSchemaGroupRef) { // group ref
                XmlSchemaGroupRef newGroupRef = (XmlSchemaGroupRef)particle.Clone();
                newGroupRef.RefName = newGroupRef.RefName.Clone();
                return newGroupRef;
            }
            else {
                XmlSchemaElement oldElem = particle as XmlSchemaElement;
                // If the particle is an element and one of the following is true:
                //   - it references another element by name
                //   - it references its type by name
                //   - it's form (effective) is qualified (meaning it will inherint namespace from chameleon includes if that happens)
                // then the element itself needs to be cloned.
                if (oldElem != null && (!oldElem.RefName.IsEmpty || !oldElem.SchemaTypeName.IsEmpty ||
                    GetResolvedElementForm(parentSchema, oldElem) == XmlSchemaForm.Qualified)) {
                    XmlSchemaElement newElem = (XmlSchemaElement)oldElem.Clone(parentSchema);
                    return newElem;
                }
            }
            return particle;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:30,代码来源:XmlSchemaComplexType.cs

示例3: CloneParticle

 internal static XmlSchemaParticle CloneParticle(XmlSchemaParticle particle, XmlSchema parentSchema)
 {
     XmlSchemaGroupBase base2 = particle as XmlSchemaGroupBase;
     if (base2 != null)
     {
         XmlSchemaGroupBase base3 = base2;
         XmlSchemaObjectCollection newItems = CloneGroupBaseParticles(base2.Items, parentSchema);
         base3 = (XmlSchemaGroupBase) base2.Clone();
         base3.SetItems(newItems);
         return base3;
     }
     if (particle is XmlSchemaGroupRef)
     {
         XmlSchemaGroupRef ref2 = (XmlSchemaGroupRef) particle.Clone();
         ref2.RefName = ref2.RefName.Clone();
         return ref2;
     }
     XmlSchemaElement element = particle as XmlSchemaElement;
     if ((element == null) || ((element.RefName.IsEmpty && element.SchemaTypeName.IsEmpty) && (GetResolvedElementForm(parentSchema, element) != XmlSchemaForm.Qualified)))
     {
         return particle;
     }
     return (XmlSchemaElement) element.Clone(parentSchema);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:XmlSchemaComplexType.cs


注:本文中的System.Xml.Schema.XmlSchemaParticle.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。