Clone() private method

private Clone ( ) : XmlSchemaObjectCollection
return XmlSchemaObjectCollection
Ejemplo n.º 1
0
        internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes)
        {
            if (HasAttributeQNameRef(attributes))
            {
                XmlSchemaObjectCollection  newAttributes = attributes.Clone();
                XmlSchemaAttributeGroupRef?attributeGroupRef;
                XmlSchemaAttributeGroupRef newAttGroupRef;
                XmlSchemaObject            xso;
                XmlSchemaAttribute         att;

                for (int i = 0; i < attributes.Count; i++)
                {
                    xso = attributes[i];
                    attributeGroupRef = xso as XmlSchemaAttributeGroupRef;
                    if (attributeGroupRef != null)
                    {
                        newAttGroupRef         = (XmlSchemaAttributeGroupRef)attributeGroupRef.Clone();
                        newAttGroupRef.RefName = attributeGroupRef.RefName.Clone();
                        newAttributes[i]       = newAttGroupRef;
                    }
                    else
                    { //Its XmlSchemaAttribute
                        att = (xso as XmlSchemaAttribute) !;
                        if (!att.RefName.IsEmpty || !att.SchemaTypeName.IsEmpty)
                        {
                            newAttributes[i] = att.Clone();
                        }
                    }
                }
                return(newAttributes);
            }
            return(attributes);
        }
 internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes)
 {
     if (!HasAttributeQNameRef(attributes))
     {
         return attributes;
     }
     XmlSchemaObjectCollection objects = attributes.Clone();
     for (int i = 0; i < attributes.Count; i++)
     {
         XmlSchemaObject obj2 = attributes[i];
         XmlSchemaAttributeGroupRef ref2 = obj2 as XmlSchemaAttributeGroupRef;
         if (ref2 != null)
         {
             XmlSchemaAttributeGroupRef ref3 = (XmlSchemaAttributeGroupRef) ref2.Clone();
             ref3.RefName = ref2.RefName.Clone();
             objects[i] = ref3;
         }
         else
         {
             XmlSchemaAttribute attribute = obj2 as XmlSchemaAttribute;
             if (!attribute.RefName.IsEmpty || !attribute.SchemaTypeName.IsEmpty)
             {
                 objects[i] = attribute.Clone();
             }
         }
     }
     return objects;
 }
 private static XmlSchemaObjectCollection CloneGroupBaseParticles(XmlSchemaObjectCollection groupBaseParticles, XmlSchema parentSchema)
 {
     XmlSchemaObjectCollection objects = groupBaseParticles.Clone();
     for (int i = 0; i < groupBaseParticles.Count; i++)
     {
         XmlSchemaParticle particle = (XmlSchemaParticle) groupBaseParticles[i];
         objects[i] = CloneParticle(particle, parentSchema);
     }
     return objects;
 }
Ejemplo n.º 4
0
        private static XmlSchemaObjectCollection CloneGroupBaseParticles(XmlSchemaObjectCollection groupBaseParticles, XmlSchema?parentSchema)
        {
            XmlSchemaObjectCollection newParticles = groupBaseParticles.Clone();

            for (int i = 0; i < groupBaseParticles.Count; i++)
            {
                XmlSchemaParticle p = (XmlSchemaParticle)groupBaseParticles[i];
                newParticles[i] = CloneParticle(p, parentSchema);
            }
            return(newParticles);
        }
        private static XmlSchemaObjectCollection CloneGroupBaseParticles(XmlSchemaObjectCollection groupBaseParticles, XmlSchema parentSchema) {
            XmlSchemaObjectCollection newParticles = groupBaseParticles.Clone();

            for (int i = 0; i < groupBaseParticles.Count; i++) {
                XmlSchemaParticle p = (XmlSchemaParticle)groupBaseParticles[i];
                newParticles[i] = CloneParticle(p, parentSchema);
            }
            return newParticles; 
        }
        internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes) {
            if (HasAttributeQNameRef(attributes)) {
                XmlSchemaObjectCollection newAttributes = attributes.Clone();
                XmlSchemaAttributeGroupRef attributeGroupRef;
                XmlSchemaAttributeGroupRef newAttGroupRef;
                XmlSchemaObject xso;
                XmlSchemaAttribute att;

                for (int i = 0; i < attributes.Count; i++) {
                    xso = attributes[i];
                    attributeGroupRef = xso as XmlSchemaAttributeGroupRef;
                    if (attributeGroupRef != null) {
                        newAttGroupRef = (XmlSchemaAttributeGroupRef)attributeGroupRef.Clone();
                        newAttGroupRef.RefName = attributeGroupRef.RefName.Clone();
                        newAttributes[i] = newAttGroupRef;
                    }
                    else { //Its XmlSchemaAttribute
                        att = xso as XmlSchemaAttribute;
                        if (!att.RefName.IsEmpty || !att.SchemaTypeName.IsEmpty) {
                            newAttributes[i] = att.Clone();     
                        }
                    }
                }
                return newAttributes;
            }
            return attributes;
        }
 internal static XmlSchemaObjectCollection CloneAttributes(XmlSchemaObjectCollection attributes)
 {
     if (!HasAttributeQNameRef(attributes))
     {
         return attributes;
     }
     XmlSchemaObjectCollection objects = attributes.Clone();
     for (int i = 0; i < attributes.Count; i++)
     {
         XmlSchemaObject obj2 = attributes[i];
         XmlSchemaAttributeGroupRef ref2 = obj2 as XmlSchemaAttributeGroupRef;
         if (ref2 != null)
         {
             XmlSchemaAttributeGroupRef ref3 = (XmlSchemaAttributeGroupRef) ref2.Clone();
             ref3.RefName = ref2.RefName.Clone();
             objects[i] = ref3;
         }
         else
         {
             XmlSchemaAttribute attribute = obj2 as XmlSchemaAttribute;
             if (!attribute.RefName.IsEmpty || !attribute.SchemaTypeName.IsEmpty)
             {
                 objects[i] = attribute.Clone();
             }
         }
     }
     return objects;
 }