Ejemplo n.º 1
0
        protected override void Visit(XmlSchemaAttributeGroupRef groupRef)
        {
            var group = _schemaSet.ResolveGroup(groupRef);

            AddParent(group);
            Traverse(group);
        }
        /// <summary>
        /// Gets attribute completion data from a group ref.
        /// </summary>
        void GetAttributeCompletionData(XmlCompletionDataList data, XmlSchemaAttributeGroupRef groupRef)
        {
            var group = FindAttributeGroup(schema, groupRef.RefName.Name);

            if (group != null)
            {
                GetAttributeCompletionData(data, group.Attributes);
            }
        }
Ejemplo n.º 3
0
        protected override void Visit(XmlSchemaAttributeGroupRef groupRef)
        {
            var group = _schemaSetManager.SchemaSet.ResolveGroup(groupRef);

            Traverse(group.Attributes);
            if (group.AnyAttribute != null)
            {
                Traverse(group.AnyAttribute);
            }
        }
        void Add_Attributes(TreeNode innerNode, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)
        {
            foreach (XmlSchemaObject at in atts)
            {
                if (at is XmlSchemaAttribute)
                {
                    XmlSchemaAttribute attr    = (XmlSchemaAttribute)at;
                    XmlSchemaAttribute refAttr = attr;

                    if (!attr.RefName.IsEmpty)
                    {
                        refAttr = GetRefAttribute(attr.RefName);
                        if (refAttr == null)
                        {
                            throw new Exception("Global attribute not found: " + attr.RefName);
                        }
                    }

                    string type;
                    if (!refAttr.SchemaTypeName.IsEmpty)
                    {
                        type = GetBuiltInTypeName(refAttr.SchemaTypeName);
                    }
                    else
                    {
                        type = GetBuiltInType(refAttr.SchemaType);
                    }

                    TreeNode node = new TreeNode(refAttr.Name);

                    if (refAttr.QualifiedName.Namespace != string.Empty)
                    {
                        node.Text = NamespaceHandler.LoopupPrefix(_namespaces, refAttr.QualifiedName.Namespace) + ":" + refAttr.Name;
                    }

                    NodeData data = new NodeData(at, refAttr.QualifiedName, type);
                    node.Tag = data;

                    innerNode.Nodes.Add(node);
                }
                else if (at is XmlSchemaAttributeGroupRef)
                {
                    XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)at;
                    XmlSchemaAttributeGroup    grp  = (XmlSchemaAttributeGroup)_schemas.Find(gref.RefName, typeof(XmlSchemaAttributeGroup));
                    Add_Attributes(innerNode, grp.Attributes, grp.AnyAttribute);
                }
            }

            if (anyat != null)
            {
                TreeNode node = new TreeNode("any custom-attribute");
                innerNode.Nodes.Add(node);
            }
        }
 XmlSchemaAttribute FindAttribute(XmlSchemaAttributeGroupRef groupRef, string name)
 {
     if (groupRef.RefName != null)
     {
         var group = FindAttributeGroup(schema, groupRef.RefName.Name);
         if (group != null)
         {
             return(FindAttribute(group.Attributes, name));
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
        public static bool getAttributes(object item, List <XmlSchemaAttribute> attributes)
        {
            if (item is XmlSchemaComplexType)
            {
                XmlSchemaComplexType complexType = (XmlSchemaComplexType)item;
                foreach (object entry in complexType.AttributeUses)
                {
                    object o = null;
                    if (entry is System.Collections.DictionaryEntry)
                    {
                        System.Collections.DictionaryEntry de = (System.Collections.DictionaryEntry)entry;
                        object key   = de.Key;
                        object value = de.Value;
                        o = value;
                    }
                    if (o is XmlSchemaAttribute)
                    {
                        attributes.Add((XmlSchemaAttribute)o);
                    }
                    else if (o is XmlSchemaAttributeGroupRef)
                    {
                        XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef)o;
                        XmlQualifiedName           qname    = groupRef.RefName;
                        if (qname != null)
                        {
                            XmlSchemaAttributeGroup group = null;
                            if (SchemaManager.GetAttributeGroup(qname.Namespace, qname.Name, out group))
                            {
                                foreach (object oo in group.Attributes)
                                {
                                    if (oo is XmlSchemaAttribute)
                                    {
                                        attributes.Add((XmlSchemaAttribute)oo);
                                    }
                                }
                            }
                        }
                    }
                }

                if (complexType.ContentModel != null && complexType.ContentModel.Content is XmlSchemaComplexContentExtension)
                {
                    XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)complexType.ContentModel.Content;
                    XmlSchemaComplexType             baseType;
                    if (ext.BaseTypeName != null && SchemaManager.GetComplexType(ext.BaseTypeName.Namespace, ext.BaseTypeName.Name, out baseType))
                    {
                        getAttributes(baseType, attributes);
                    }
                }
            }

            return(attributes.Count > 0);
        }
Ejemplo n.º 7
0
        public XmlSchema GetDataSchemas(XmlSchema querySchema, IEnumerable <Registration> registrations)
        {
            var schema = new XmlSchema {
                TargetNamespace = RegistrationStorage.Dataspace
            };

            schema.Namespaces.Add("", RegistrationStorage.Dataspace);
            var guid = CreateGuidType();

            schema.Items.Add(guid);
            schema.Includes.Add(new XmlSchemaImport {
                Schema = querySchema, Namespace = querySchema.TargetNamespace
            });
            foreach (var registration in registrations)
            {
                var etype = new XmlSchemaComplexType
                {
                    Name       = registration.ResourceName,
                    Annotation = new XmlSchemaAnnotation()
                };
                var doc = new XmlSchemaDocumentation {
                    Markup = TextToNode(registration.ResourceType.FullName)
                };
                etype.Annotation.Items.Add(doc);
                etype.Block = XmlSchemaDerivationMethod.Extension;
                var idAttr = new XmlSchemaAttribute
                {
                    Name           = "Id",
                    SchemaTypeName = new XmlQualifiedName(guid.Name, RegistrationStorage.Dataspace),
                    Use            = XmlSchemaUse.Required
                };
                etype.Attributes.Add(idAttr);
                var noChildrenAttr = new XmlSchemaAttribute
                {
                    Name       = RegistrationStorage.DefinitlyNoChildren,
                    SchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Boolean),
                    Use        = XmlSchemaUse.Optional
                };
                etype.Attributes.Add(noChildrenAttr);
                if (querySchema.Items.OfType <XmlSchemaAttributeGroup>().Any(k => k.Name == etype.Name))
                {
                    var group = new XmlSchemaAttributeGroupRef();
                    group.RefName = new XmlQualifiedName(etype.Name.Replace(" ", "_"), querySchema.TargetNamespace);
                    etype.Attributes.Add(group);
                }
                schema.Items.Add(etype);
            }

            return(schema);
        }
Ejemplo n.º 8
0
 void CollectAttributes(XmlSchemaObjectCollection xsos)
 {
     foreach (XmlSchemaObject xso in xsos)
     {
         XmlSchemaAttribute attr = xso as XmlSchemaAttribute;
         if (attr != null)
         {
             this.attributes.Add(attr);
             continue;
         }
         XmlSchemaAttributeGroupRef gref = xso as XmlSchemaAttributeGroupRef;
         CollectAttributes(((XmlSchemaAttributeGroup)this.schema.AttributeGroups[gref.RefName]).Attributes);
     }
 }
Ejemplo n.º 9
0
        void ProcessAttributes(XmlSchemaObjectCollection Atts, int level, P_PSMClass current)
        {
            if (Atts.Count > 0)
            {
                Print("Attributes: " +
                      Atts.Count + Environment.NewLine, level);

                foreach (XmlSchemaObject O in Atts)
                {
                    if (O is XmlSchemaAttribute)
                    {
                        XmlSchemaAttribute A = O as XmlSchemaAttribute;
                        Print("Att name: \"" + A.Name + "\" type: \"" +
                              A.SchemaTypeName.Namespace + ": " + A.SchemaTypeName.Name + "\" use: \"" +
                              A.Use + "\"" + Environment.NewLine, level + 1);
                        if (current != null)
                        {
                            P_PSMAttribute a = new P_PSMAttribute()
                            {
                                Alias        = A.Name,
                                type         = A.SchemaTypeName,
                                DefaultValue = A.DefaultValue,
                                FixedValue   = A.FixedValue,
                                Form         = A.Form
                            };
                            SetAttributeUse(a, A);
                            current.Attributes.Add(a);
                        }
                    }
                    else if (O is XmlSchemaAttributeGroupRef)
                    {
                        XmlSchemaAttributeGroupRef G = O as XmlSchemaAttributeGroupRef;
                        Print("AttGroupRef: \"" + G.RefName.Name + "\"" + Environment.NewLine, level);

                        /* CANNOT HAVE MULTIPLE REPRESENTED CLASSES - MUST COPY ATTRIBUTES
                         * //create SR
                         * if (current.SRof != null) Print("Warning: Overwriting SRof \"" +
                         *  current.SRof + " with \"" + G.RefName.Name + "\"." + Environment.NewLine, level);
                         * current.SRof = G.RefName.Name;*/

                        current.AttrGroupRefs.Add(G.RefName);
                    }
                    else
                    {
                        Print("Unknown object in type.Attributes collection" + Environment.NewLine, level);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 private void Write32_XmlSchemaAttributeGroupRef(XmlSchemaAttributeGroupRef o)
 {
     if (o != null)
     {
         this.WriteStartElement("attributeGroup");
         this.WriteAttribute("id", "", o.Id);
         if (!o.RefName.IsEmpty)
         {
             this.WriteAttribute("ref", "", o.RefName);
         }
         this.WriteAttributes(o.UnhandledAttributes, o);
         this.Write5_XmlSchemaAnnotation(o.Annotation);
         this.WriteEndElement();
     }
 }
        internal XSAttributeGroupDefinition(XmlSchemaAttributeGroupRef xmlAttributeGroupRef)
            : this()
        {
            _attributeGroup = xmlAttributeGroupRef;

            if (_attributeGroup.Annotation is XmlSchemaAnnotation annotation)
            {
                _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation);
                _annotation.BindToContainer(RootContainer, this);
            }

            if (xmlAttributeGroupRef.RefName is XmlQualifiedName qualifiedName)
            {
                _reference = XMLSchemaSerializer.CreateXMLExpandedName(qualifiedName);
            }
        }
Ejemplo n.º 12
0
 private bool LoadXmlSchemaAttributeGroupRef(XmlSchemaAttributeGroupRef attGroupRef)
 {
     if (attGroupRef == null)
     {
         return(false);
     }
     if (attGroupRef.RefName != null)
     {
         string groupName = attGroupRef.RefName.Name;
         if (xcontoler._attributeGroups.ContainsKey(groupName))
         {
             XmlSchemaAttributeGroup attGroup = xcontoler._attributeGroups[groupName];
             LoadXmlSchemaObjectCollection(attGroup.Attributes);
         }
     }
     return(true);
 }
Ejemplo n.º 13
0
        void WriteAttributes(XmlTextWriter xtw, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)
        {
            foreach (XmlSchemaObject at in atts)
            {
                if (at is XmlSchemaAttribute)
                {
                    XmlSchemaAttribute attr    = (XmlSchemaAttribute)at;
                    XmlSchemaAttribute refAttr = attr;

                    // refAttr.Form; TODO

                    if (!attr.RefName.IsEmpty)
                    {
                        refAttr = FindRefAttribute(attr.RefName);
                        if (refAttr == null)
                        {
                            throw new InvalidOperationException("Global attribute not found: " + attr.RefName);
                        }
                    }

                    string val;
                    if (!refAttr.SchemaTypeName.IsEmpty)
                    {
                        val = FindBuiltInType(refAttr.SchemaTypeName);
                    }
                    else
                    {
                        val = FindBuiltInType((XmlSchemaSimpleType)refAttr.SchemaType);
                    }

                    xtw.WriteAttributeString(refAttr.Name, val);
                }
                else if (at is XmlSchemaAttributeGroupRef)
                {
                    XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)at;
                    XmlSchemaAttributeGroup    grp  = (XmlSchemaAttributeGroup)schemas.Find(gref.RefName, typeof(XmlSchemaAttributeGroup));
                    WriteAttributes(xtw, grp.Attributes, grp.AnyAttribute);
                }
            }

            if (anyat != null)
            {
                xtw.WriteAttributeString("custom-attribute", "value");
            }
        }
Ejemplo n.º 14
0
        void Write32_XmlSchemaAttributeGroupRef(XmlSchemaAttributeGroupRef o)
        {
            if ((object)o == null)
            {
                return;
            }
            WriteStartElement("attributeGroup");

            WriteAttribute(@"id", @"", ((System.String)o.@Id));

            if (!o.RefName.IsEmpty)
            {
                WriteAttribute("ref", "", o.RefName);
            }
            WriteAttributes((XmlAttribute[])o.@UnhandledAttributes, o);
            Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)o.@Annotation);
            WriteEndElement();
        }
Ejemplo n.º 15
0
    } //WriteExampleElement()

    // Write some example attributes
    public static void WriteExampleAttributes(XmlSchemaObjectCollection attributes,
                                              XmlSchema myXmlSchema,
                                              XmlTextWriter myXmlTextWriter)
    {
        foreach (object o in attributes)
        {
            if (o is XmlSchemaAttribute)
            {
                WriteExampleAttribute((XmlSchemaAttribute)o, myXmlTextWriter);
            } //if
            else
            {
                XmlSchemaAttributeGroupRef xsagr = (XmlSchemaAttributeGroupRef)o;
                XmlSchemaAttributeGroup    group =
                    (XmlSchemaAttributeGroup)myXmlSchema.AttributeGroups[xsagr.RefName];
                WriteExampleAttributes(group.Attributes, myXmlSchema, myXmlTextWriter);
            } //else
        }     //foreach
    }         //WriteExampleAttributes()
Ejemplo n.º 16
0
        XmlSchemaAttribute FindArrayAttribute(XmlSchemaObjectCollection atts)
        {
            foreach (object ob in atts)
            {
                XmlSchemaAttribute att = ob as XmlSchemaAttribute;
                if (att != null && att.RefName == arrayTypeRefName)
                {
                    return(att);
                }

                XmlSchemaAttributeGroupRef gref = ob as XmlSchemaAttributeGroupRef;
                if (gref != null)
                {
                    XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup)schemas.Find(gref.RefName, typeof(XmlSchemaAttributeGroup));
                    att = FindArrayAttribute(grp.Attributes);
                    if (att != null)
                    {
                        return(att);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 17
0
        static void Check(ConformanceCheckContext ctx, ConformanceChecker checker, Hashtable visitedObjects, XmlSchemaObject value)
        {
            if (value == null)
            {
                return;
            }

            if (visitedObjects.Contains(value))
            {
                return;
            }
            visitedObjects.Add(value, value);

            if (value is XmlSchemaImport)
            {
                XmlSchemaImport so = (XmlSchemaImport)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaAll)
            {
                XmlSchemaAll so = (XmlSchemaAll)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Items);
            }
            else if (value is XmlSchemaAnnotation)
            {
                XmlSchemaAnnotation so = (XmlSchemaAnnotation)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Items);
            }
            else if (value is XmlSchemaAttribute)
            {
                XmlSchemaAttribute so = (XmlSchemaAttribute)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaAttributeGroup)
            {
                XmlSchemaAttributeGroup so = (XmlSchemaAttributeGroup)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
                Check(ctx, checker, visitedObjects, so.RedefinedAttributeGroup);
            }
            else if (value is XmlSchemaAttributeGroupRef)
            {
                XmlSchemaAttributeGroupRef so = (XmlSchemaAttributeGroupRef)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaChoice)
            {
                XmlSchemaChoice so = (XmlSchemaChoice)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Items);
            }
            else if (value is XmlSchemaComplexContent)
            {
                XmlSchemaComplexContent so = (XmlSchemaComplexContent)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Content);
            }
            else if (value is XmlSchemaComplexContentExtension)
            {
                XmlSchemaComplexContentExtension so = (XmlSchemaComplexContentExtension)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Particle);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
            }
            else if (value is XmlSchemaComplexContentRestriction)
            {
                XmlSchemaComplexContentRestriction so = (XmlSchemaComplexContentRestriction)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Particle);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
            }
            else if (value is XmlSchemaComplexType)
            {
                XmlSchemaComplexType so = (XmlSchemaComplexType)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.ContentModel);
                Check(ctx, checker, visitedObjects, so.Particle);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
                Check(ctx, checker, visitedObjects, so.ContentTypeParticle);
                Check(ctx, checker, visitedObjects, so.AttributeWildcard);
            }
            else if (value is XmlSchemaElement)
            {
                XmlSchemaElement so = (XmlSchemaElement)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.SchemaType);
                CheckObjects(ctx, checker, visitedObjects, so.Constraints);
            }
            else if (value is XmlSchemaGroup)
            {
                XmlSchemaGroup so = (XmlSchemaGroup)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Particle);
            }
            else if (value is XmlSchemaGroupRef)
            {
                XmlSchemaGroupRef so = (XmlSchemaGroupRef)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaIdentityConstraint)
            {
                XmlSchemaIdentityConstraint so = (XmlSchemaIdentityConstraint)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Fields);
                Check(ctx, checker, visitedObjects, so.Selector);
            }
            else if (value is XmlSchemaKeyref)
            {
                XmlSchemaKeyref so = (XmlSchemaKeyref)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaRedefine)
            {
                XmlSchemaRedefine so = (XmlSchemaRedefine)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Items);
            }
            else if (value is XmlSchemaSequence)
            {
                XmlSchemaSequence so = (XmlSchemaSequence)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Items);
            }
            else if (value is XmlSchemaSimpleContent)
            {
                XmlSchemaSimpleContent so = (XmlSchemaSimpleContent)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Content);
            }
            else if (value is XmlSchemaSimpleContentExtension)
            {
                XmlSchemaSimpleContentExtension so = (XmlSchemaSimpleContentExtension)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
            }
            else if (value is XmlSchemaSimpleContentRestriction)
            {
                XmlSchemaSimpleContentRestriction so = (XmlSchemaSimpleContentRestriction)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Attributes);
                Check(ctx, checker, visitedObjects, so.AnyAttribute);
                CheckObjects(ctx, checker, visitedObjects, so.Facets);
            }
            else if (value is XmlSchemaSimpleType)
            {
                XmlSchemaSimpleType so = (XmlSchemaSimpleType)value;
                checker.Check(ctx, so);
                Check(ctx, checker, visitedObjects, so.Content);
            }
            else if (value is XmlSchemaSimpleTypeList)
            {
                XmlSchemaSimpleTypeList so = (XmlSchemaSimpleTypeList)value;
                checker.Check(ctx, so);
            }
            else if (value is XmlSchemaSimpleTypeRestriction)
            {
                XmlSchemaSimpleTypeRestriction so = (XmlSchemaSimpleTypeRestriction)value;
                checker.Check(ctx, so);
                CheckObjects(ctx, checker, visitedObjects, so.Facets);
            }
            else if (value is XmlSchemaSimpleTypeUnion)
            {
                XmlSchemaSimpleTypeUnion so = (XmlSchemaSimpleTypeUnion)value;
                checker.Check(ctx, so);
            }
        }
Ejemplo n.º 18
0
    private void method_4(XmlSchemaGroupBase A_0, XmlNode A_1, bool A_2)
    {
        int num = 8;
        XmlSchemaComplexType item = new XmlSchemaComplexType {
            Name = A_1.Attributes[BookmarkStart.b("䀭儯弱儳", 8)].Value
        };

        if (A_2)
        {
            string            name = item.Name + BookmarkStart.b("椭䈯崱䄳䘵", num);
            XmlSchemaGroupRef ref2 = new XmlSchemaGroupRef {
                RefName = new XmlQualifiedName(name)
            };
            item.Particle = ref2;
            XmlSchemaGroup group = new XmlSchemaGroup {
                Name     = name,
                Particle = A_0
            };
            this.xmlSchema_0.Items.Add(group);
        }
        else
        {
            item.Particle = A_0;
            item.Particle.MaxOccursString = BookmarkStart.b("嬭帯倱嬳䌵嘷帹夻娽", num);
            item.Particle.MinOccurs       = 0M;
        }
        this.xmlSchema_0.Items.Add(item);
        foreach (XmlNode node4 in A_1.SelectNodes(BookmarkStart.b("䌭ਯ圱堳匵唷弹刻䨽", num), this.xmlNamespaceManager_0))
        {
            this.method_5(node4, A_0);
        }
        foreach (XmlNode node in A_1.SelectNodes(BookmarkStart.b("䌭ਯ唱䘳夵䴷䨹", num), this.xmlNamespaceManager_0))
        {
            XmlAttribute attribute = node.Attributes[BookmarkStart.b("尭唯吱", num)];
            if (attribute != null)
            {
                XmlNode node2 = this.xmlElement_0.SelectSingleNode(BookmarkStart.b("䌭ਯ唱䘳夵䴷䨹朻總⸿⍁⥃⍅畇浉", num) + attribute.Value + BookmarkStart.b("भ洯", num), this.xmlNamespaceManager_0);
                this.method_6(node2, A_0);
            }
            else
            {
                this.method_6(node, A_0);
            }
        }
        XmlSchemaObjectCollection attributes = item.Attributes;

        if (A_2)
        {
            string str2 = item.Name + BookmarkStart.b("漭䐯䘱䘳焵䨷唹䤻丽", num);
            XmlSchemaAttributeGroupRef ref3 = new XmlSchemaAttributeGroupRef {
                RefName = new XmlQualifiedName(str2)
            };
            item.Attributes.Add(ref3);
            XmlSchemaAttributeGroup group2 = new XmlSchemaAttributeGroup {
                Name = str2
            };
            this.xmlSchema_0.Items.Add(group2);
            attributes = group2.Attributes;
        }
        foreach (XmlNode node3 in A_1.SelectNodes(BookmarkStart.b("䌭ਯ匱䀳䈵䨷匹帻䬽㐿❁", num), this.xmlNamespaceManager_0))
        {
            this.method_7(node3, attributes);
        }
        XmlSchemaAttribute attribute2 = new XmlSchemaAttribute {
            Name           = BookmarkStart.b("䜭启", num),
            SchemaTypeName = new XmlQualifiedName(BookmarkStart.b("䜭帯䘱", num), BookmarkStart.b("䘭䐯䘱䐳వ᜷ᔹ䬻䤽㜿汁㍃畅晇╉㹋⥍罏恑摓晕楗留ћ፝ⱟㅡݣ๥൧ݩ൫", num))
        };

        item.Attributes.Add(attribute2);
    }
Ejemplo n.º 19
0
        public static XmlSchemaAttributeGroup ResolveGroup(this XmlSchemaSet schemaSet, XmlSchemaAttributeGroupRef groupRef)
        {
            foreach (var schema in schemaSet.GetAllSchemas())
            {
                var group = (XmlSchemaAttributeGroup)schema.AttributeGroups[groupRef.RefName];
                if (group != null)
                {
                    return(group);
                }
            }

            return(null);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///     Returns the XmlSchemaAttributeGroup specified by the given XmlSchemaAttributeGroupRef from the instance's XmlSchemaSet.
        /// </summary>
        /// <param name="xsagr"></param>
        /// <returns></returns>
        private XmlSchemaAttributeGroup GetXmlSchemaAttributeGroupFromAttributeGroupRef(XmlSchemaAttributeGroupRef xsagr)
        {
            var schema = GetSchemaFromSchemaSet(xsagr.RefName.Namespace);
            XmlSchemaAttributeGroup xsag = null;

            if (schema != null)
            {
                if (schema.AttributeGroups.Contains(xsagr.RefName))
                {
                    xsag = schema.AttributeGroups[xsagr.RefName] as XmlSchemaAttributeGroup;
                }
            }
            else
            {
                // couldn't find specific schema, so scan all schemas' atribute groups.
                foreach (XmlSchema s in SchemaSet.Schemas())
                {
                    if (s.AttributeGroups.Contains(xsagr.RefName))
                    {
                        xsag = s.AttributeGroups[xsagr.RefName] as XmlSchemaAttributeGroup;
                        break;
                    }
                }
            }

            Debug.Assert(xsag != null, "didn't find XmlSchemaAttributeGroup " + xsagr.RefName + " in schema " + xsagr.RefName.Namespace);

            return(xsag);
        }
Ejemplo n.º 21
0
 protected virtual void Visit(XmlSchemaAttributeGroupRef groupRef)
 {
 }
 public override void Check(ConformanceCheckContext ctx, XmlSchemaAttributeGroupRef value)
 {
     CheckSchemaQName(ctx, value, value.RefName);
 }
Ejemplo n.º 23
0
 public virtual void Check(ConformanceCheckContext ctx, XmlSchemaAttributeGroupRef value)
 {
 }
Ejemplo n.º 24
0
    public static void Main()
    {
        XmlSchema schema = new XmlSchema();

        // <xs:attributeGroup name="myAttributeGroup">
        XmlSchemaAttributeGroup myAttributeGroup = new XmlSchemaAttributeGroup();

        schema.Items.Add(myAttributeGroup);
        myAttributeGroup.Name = "myAttributeGroup";

        // <xs:attribute name="someattribute1" type="xs:integer"/>
        XmlSchemaAttribute someattribute1 = new XmlSchemaAttribute();

        myAttributeGroup.Attributes.Add(someattribute1);
        someattribute1.Name           = "someattribute1";
        someattribute1.SchemaTypeName = new XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");


        // <xs:attribute name="someattribute2" type="xs:string"/>
        XmlSchemaAttribute someattribute2 = new XmlSchemaAttribute();

        myAttributeGroup.Attributes.Add(someattribute2);
        someattribute2.Name           = "someattribute2";
        someattribute2.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");

        // <xs:complexType name="myElementType">
        XmlSchemaComplexType myElementType = new XmlSchemaComplexType();

        schema.Items.Add(myElementType);
        myElementType.Name = "myElementType";

        // <xs:attributeGroup ref="myAttributeGroup"/>
        XmlSchemaAttributeGroupRef myAttributeGroupRef = new XmlSchemaAttributeGroupRef();

        myElementType.Attributes.Add(myAttributeGroupRef);
        myAttributeGroupRef.RefName = new XmlQualifiedName("myAttributeGroup");

        // <xs:attributeGroup name="myAttributeGroupA">
        XmlSchemaAttributeGroup myAttributeGroupA = new XmlSchemaAttributeGroup();

        schema.Items.Add(myAttributeGroupA);
        myAttributeGroupA.Name = "myAttributeGroupA";

        // <xs:attribute name="someattribute10" type="xs:integer"/>
        XmlSchemaAttribute someattribute10 = new XmlSchemaAttribute();

        myAttributeGroupA.Attributes.Add(someattribute10);
        someattribute10.Name           = "someattribute10";
        someattribute10.SchemaTypeName = new XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema");

        // <xs:attribute name="someattribute11" type="xs:string"/>
        XmlSchemaAttribute someattribute11 = new XmlSchemaAttribute();

        myAttributeGroupA.Attributes.Add(someattribute11);
        someattribute11.Name           = "someattribute11";
        someattribute11.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");

        // <xs:attributeGroup name="myAttributeGroupB">
        XmlSchemaAttributeGroup myAttributeGroupB = new XmlSchemaAttributeGroup();

        schema.Items.Add(myAttributeGroupB);
        myAttributeGroupB.Name = "myAttributeGroupB";

        // <xs:attribute name="someattribute20" type="xs:date"/>
        XmlSchemaAttribute someattribute20 = new XmlSchemaAttribute();

        myAttributeGroupB.Attributes.Add(someattribute20);
        someattribute20.Name           = "someattribute20";
        someattribute20.SchemaTypeName = new XmlQualifiedName("date", "http://www.w3.org/2001/XMLSchema");

        // <xs:attributeGroup ref="myAttributeGroupA"/>
        XmlSchemaAttributeGroupRef myAttributeGroupRefA = new XmlSchemaAttributeGroupRef();

        myAttributeGroupB.Attributes.Add(myAttributeGroupRefA);
        myAttributeGroupRefA.RefName = new XmlQualifiedName("myAttributeGroupA");

        XmlSchemaSet schemaSet = new XmlSchemaSet();

        schemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallbackOne);
        schemaSet.Add(schema);
        schemaSet.Compile();

        XmlSchema compiledSchema = null;

        foreach (XmlSchema schema1 in schemaSet.Schemas())
        {
            compiledSchema = schema1;
        }

        XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());

        nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
        compiledSchema.Write(Console.Out, nsmgr);
    }
Ejemplo n.º 25
0
 private static void Equal(XmlSchemaAttributeGroupRef expected, XmlSchemaAttributeGroupRef actual)
 {
     AnnotatedEqual(expected, actual);
     Assert.Equal(expected.RefName, actual.RefName);
 }