Пример #1
0
        public bool isCollection(
            string schemaName_in,

            out string ntype_out,
            out string name_out
            )
        {
            ntype_out = string.Empty;
            name_out  = string.Empty;

            ExtendedMetadata_complexTypeKeys _complextypekeys
                = root_ref.ExtendedMetadata.ComplexTypeKeys[Type];

            if (_complextypekeys != null)
            {
                XS_Schema _schema = root_ref_.SchemaCollection[schemaName_in];

                for (int c = 0; c < _schema.ComplexType.Count; c++)
                {
                    for (int a = 0; a < _schema.ComplexType[c].Attribute.Count; a++)
                    {
                        if (_schema.ComplexType[c].Attribute[a].Name == _complextypekeys.Keys)
                        {
                            ntype_out = _schema.ComplexType[c].Attribute[a].NType;
                            name_out  = _schema.ComplexType[c].Attribute[a].Name;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public bool mustImplementCollection(
            string schemaName_in,

            out string keys_ntype_out,
            out string keys_name_out
            )
        {
            keys_ntype_out = string.Empty;
            keys_name_out  = string.Empty;

            XS_Schema _schema = root_ref_.SchemaCollection[schemaName_in];

            for (int c = 0; c < _schema.ComplexType.Count; c++)
            {
                for (int e = 0; e < _schema.ComplexType[c].Sequence.Element.Count; e++)
                {
                    if (
                        // if there's an Element pointing this ComplexType
                        (_schema.ComplexType[c].Sequence.Element[e].Type == Name)
                        &&
                        // and if this Element occurance is unbounded
                        (_schema.ComplexType[c].Sequence.Element[e].MaxOccurs
                         == XS_Element.MaxOccursEnum.unbounded)
                        )
                    {
                        // then this ComplexType must implement a Collection

                        ExtendedMetadata_complexTypeKeys _complextypekeys
                            = root_ref_.ExtendedMetadata.ComplexTypeKeys[
                                  Name
                              ];

                        if (_complextypekeys != null)
                        {
                            for (int a = 0; a < Attribute.Count; a++)
                            {
                                if (Attribute[a].Name == _complextypekeys.Keys)
                                {
                                    keys_name_out  = Attribute[a].Name;
                                    keys_ntype_out = Attribute[a].NType;
                                }
                            }
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }