コード例 #1
0
 bool IsDefaultSchemaNamespaceDefinedInPathsByNamespace(XmlNamespaceCollection namespaces, XmlSchemaCompletion defaultSchema)
 {
     if (defaultSchema != null)
     {
         return(namespaces.Contains(defaultSchema.Namespace));
     }
     return(true);
 }
コード例 #2
0
 void FindNamespacesWithoutAssociatedPaths(XmlNamespaceCollection namespacesInScope)
 {
     foreach (XmlNamespace ns in namespacesInScope)
     {
         if (!HavePathForNamespace(ns))
         {
             namespacesWithoutPaths.Add(ns);
         }
     }
 }
コード例 #3
0
        public XmlCompletionItemCollection GetRootElementCompletion(XmlNamespaceCollection namespaces)
        {
            XmlCompletionItemCollection items = new XmlCompletionItemCollection();

            foreach (XmlNamespace ns in namespaces)
            {
                foreach (XmlSchemaCompletion schema in GetSchemas(ns.Name))
                {
                    items.AddRange(schema.GetRootElementCompletion(ns.Prefix));
                }
            }
            return(items);
        }
コード例 #4
0
        /// <summary>
        /// Gets the list of namespaces in the namespace list.
        /// </summary>
        public XmlNamespaceCollection GetNamespaces()
        {
            XmlNamespaceCollection namespaces = new XmlNamespaceCollection();

            for (int i = 0; i < namespacesDataGridView.Rows.Count - 1; ++i)
            {
                DataGridViewRow row    = namespacesDataGridView.Rows[i];
                string          prefix = GetPrefix(row);
                string          uri    = GetNamespace(row);
                if (prefix.Length == 0 && uri.Length == 0)
                {
                    // Ignore.
                }
                else
                {
                    namespaces.Add(new XmlNamespace(prefix, uri));
                }
            }
            return(namespaces);
        }
コード例 #5
0
        public XmlCompletionItemCollection GetElementCompletion(XmlElementPathsByNamespace pathsByNamespace, XmlSchemaCompletion defaultSchema)
        {
            XmlCompletionItemCollection items = new XmlCompletionItemCollection();

            foreach (XmlElementPath path in pathsByNamespace)
            {
                items.AddRange(GetChildElementCompletion(path, defaultSchema));
            }

            XmlNamespaceCollection namespaceWithoutPaths = pathsByNamespace.NamespacesWithoutPaths;

            if (items.Count == 0)
            {
                if (!IsDefaultSchemaNamespaceDefinedInPathsByNamespace(namespaceWithoutPaths, defaultSchema))
                {
                    namespaceWithoutPaths.Add(defaultSchema.Namespace);
                }
            }
            items.AddRange(GetRootElementCompletion(namespaceWithoutPaths));
            return(items);
        }
コード例 #6
0
 public XPathQuery(string xml, XmlNamespaceCollection namespaces)
 {
     this.xml        = xml;
     this.namespaces = namespaces;
 }
コード例 #7
0
 public XPathQuery(ITextEditor textEditor, XmlNamespaceCollection namespaces)
     : this(textEditor.Document.Text, namespaces)
 {
 }