public XmlIntellisenseList GetNamespaceList(XmlNode node)
        {
            XmlIntellisenseList list = new XmlIntellisenseList();

            list.IsOpen = true;

            Dictionary <string, string> map = new Dictionary <string, string>();

            foreach (XmlNode a in node.SelectNodes("namespace::*"))
            {
                string tns = a.Value;
                list.Add(tns, null);
            }
            foreach (CacheEntry ce in this.model.SchemaCache.GetSchemas())
            {
                if (ce.Schema == null)
                {
                    continue;
                }
                string tns = ce.Schema.TargetNamespace;
                list.Add(tns, null);
            }
            list.Add("http://www.w3.org/2001/XMLSchema-instance", null);
            list.Add("http://www.w3.org/2001/XMLSchema", null);
            list.Sort();

            return(list);
        }
        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;
        }
        public IIntellisenseList GetExpectedValues(XmlSchemaType si)
        {
            if (si == null)
            {
                return(null);
            }
            XmlIntellisenseList list = new XmlIntellisenseList();

            GetExpectedValues(si, list);
            return(list);
        }
 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;
 }
 public virtual IIntellisenseList GetExpectedNames()
 {
     if (checker != null)
     {
         XmlIntellisenseList list = new XmlIntellisenseList();
         if (node.NodeType == XmlNodeType.Attribute)
         {
             XmlSchemaAttribute[] expected = checker.GetExpectedAttributes();
             if (expected != null)
             {
                 foreach (XmlSchemaAttribute a in expected)
                 {
                     list.Add(GetQualifiedName(a), SchemaCache.GetAnnotation(a, SchemaCache.AnnotationNode.Tooltip, null));
                 }
             }
         }
         else
         {
             XmlSchemaParticle[] particles = checker.GetExpectedParticles();
             if (particles != null)
             {
                 foreach (XmlSchemaParticle p in particles)
                 {
                     if (p is XmlSchemaElement)
                     {
                         list.Add(GetQualifiedName((XmlSchemaElement)p), SchemaCache.GetAnnotation(p, SchemaCache.AnnotationNode.Tooltip, null));
                     }
                     else
                     {
                         // todo: expand XmlSchemaAny particles.
                         list.IsOpen = true;
                     }
                 }
             }
         }
         list.Sort();
         return(list);
     }
     return(null);
 }