Example #1
0
 public void GetExpectedValues(XmlSchemaType si, XmlIntellisenseList list)
 {
     if (si == null) return;
     if (si is XmlSchemaSimpleType) {
         XmlSchemaSimpleType st = (XmlSchemaSimpleType)si;
         GetExpectedValues(st, list);
     } else if (si is XmlSchemaComplexType) {
         XmlSchemaComplexType ct = (XmlSchemaComplexType)si;
         if (ct.ContentModel is XmlSchemaComplexContent) {
             XmlSchemaComplexContent cc = (XmlSchemaComplexContent)ct.ContentModel;
             if (cc.Content is XmlSchemaComplexContentExtension) {
                 XmlSchemaComplexContentExtension ce = (XmlSchemaComplexContentExtension)cc.Content;
                 GetExpectedValues(GetTypeInfo(ce.BaseTypeName), list);
             } else if (cc.Content is XmlSchemaComplexContentRestriction) {
                 XmlSchemaComplexContentRestriction cr = (XmlSchemaComplexContentRestriction)cc.Content;
                 GetExpectedValues(GetTypeInfo(cr.BaseTypeName), list);
             }
         } else if (ct.ContentModel is XmlSchemaSimpleContent) {
             XmlSchemaSimpleContent sc = (XmlSchemaSimpleContent)ct.ContentModel;
             if (sc.Content is XmlSchemaSimpleContentExtension) {
                 XmlSchemaSimpleContentExtension ce = (XmlSchemaSimpleContentExtension)sc.Content;
                 GetExpectedValues(GetTypeInfo(ce.BaseTypeName), list);
             } else if (sc.Content is XmlSchemaSimpleContentRestriction) {
                 XmlSchemaSimpleContentRestriction cr = (XmlSchemaSimpleContentRestriction)sc.Content;
                 GetExpectedValues(GetTypeInfo(cr.BaseTypeName), list);
             }
         }
     }
     return;
 }
Example #2
0
        void GetExpectedValues(XmlSchemaSimpleType st, XmlIntellisenseList list)
        {
            if (st == null) return;
            if (st.Datatype != null) {
                switch (st.Datatype.TypeCode) {
                    case XmlTypeCode.Language:
                        foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures)) {
                            list.Add(ci.Name, ci.DisplayName);
                        }
                        list.Sort();
                        break;
                    case XmlTypeCode.Boolean:
                        list.Add("0", null);
                        list.Add("1", null);
                        list.Add("true", null);
                        list.Add("false", null);
                        break;
                }
            }

            if (st.Content is XmlSchemaSimpleTypeList) {
                XmlSchemaSimpleTypeList ce = (XmlSchemaSimpleTypeList)st.Content;
                GetExpectedValues(ce.ItemType, list);
            } else if (st.Content is XmlSchemaSimpleTypeUnion) {
                XmlSchemaSimpleTypeUnion cr = (XmlSchemaSimpleTypeUnion)st.Content;
                if (cr.BaseMemberTypes != null) {
                    foreach (XmlSchemaSimpleType bt in cr.BaseMemberTypes) {
                        GetExpectedValues(bt, list);
                    }
                }
            } else if (st.Content is XmlSchemaSimpleTypeRestriction) {
                XmlSchemaSimpleTypeRestriction cr = (XmlSchemaSimpleTypeRestriction)st.Content;
                GetExpectedValues(FindSchemaType(cr.BaseTypeName), list);
                foreach (XmlSchemaFacet f in cr.Facets) {
                    if (f is XmlSchemaEnumerationFacet) {
                        XmlSchemaEnumerationFacet ef = (XmlSchemaEnumerationFacet)f;
                        list.Add(ef.Value, GetAnnotation(ef, SchemaCache.AnnotationNode.Tooltip, null));
                    }
                }
            }
            return;
        }
Example #3
0
 public IIntellisenseList GetExpectedValues(XmlSchemaType si)
 {
     if (si == null) return null;
     XmlIntellisenseList list = new XmlIntellisenseList();
     GetExpectedValues(si, list);
     return list;
 }