public XmlCompletionDataProvider(XmlSchemaCompletionDataCollection schemaCompletionDataItems, XmlSchemaCompletionData defaultSchemaCompletionData, string defaultNamespacePrefix)
 {
     this.schemaCompletionDataItems = schemaCompletionDataItems;
     this.defaultSchemaCompletionData = defaultSchemaCompletionData;
     this.defaultNamespacePrefix = defaultNamespacePrefix;
     DefaultIndex = 0;
 }
Exemple #2
0
 /// <summary>
 /// Reads an individual schema and adds it to the collection.
 /// </summary>
 /// <remarks>
 /// If the schema namespace exists in the collection it is not added.
 /// </remarks>
 public void ReadSchema(string fileName, bool readOnly)
 {
     try
     {
         string baseUri = XmlSchemaCompletionData.GetUri(fileName);
         XmlSchemaCompletionData data = new XmlSchemaCompletionData(baseUri, fileName);
         if (data.NamespaceUri != null)
         {
             if (schemas[data.NamespaceUri] == null)
             {
                 data.ReadOnly = readOnly;
                 schemas.Add(data);
             }
             else
             {
                 // Namespace already exists.
                 Debug.WriteLine("Ignoring duplicate schema namespace " + data.NamespaceUri);
             }
         }
         else
         {
             Debug.WriteLine("Ignoring schema with no namespace " + data.FileName);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Unable to read schema '" + fileName + "'. ", ex);
     }
 }
 /// <summary>
 ///   Initializes a new instance of <see cref='XmlSchemaCompletionDataCollection'/> containing any array of <see cref='XmlSchemaCompletionData'/> objects.
 /// </summary>
 /// <param name='val'>
 ///       A array of <see cref='XmlSchemaCompletionData'/> objects with which to intialize the collection
 /// </param>
 public XmlSchemaCompletionDataCollection(XmlSchemaCompletionData[] val)
 {
     this.AddRange(val);
 }
 /// <summary>
 ///   Removes a specific <see cref='XmlSchemaCompletionData'/> from the <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to remove from the <see cref='XmlSchemaCompletionDataCollection'/>.</param>
 /// <exception cref='ArgumentException'><paramref name='val'/> is not found in the Collection.</exception>
 public void Remove(XmlSchemaCompletionData val)
 {
     List.Remove(val);
 }
 /// <summary>
 ///   Inserts a <see cref='XmlSchemaCompletionData'/> into the <see cref='XmlSchemaCompletionDataCollection'/> at the specified index.
 /// </summary>
 /// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
 /// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to insert.</param>
 /// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
 public void Insert(int index, XmlSchemaCompletionData val)
 {
     List.Insert(index, val);
 }
 /// <summary>
 ///    Returns the index of a <see cref='XmlSchemaCompletionData'/> in 
 ///       the <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to locate.</param>
 /// <returns>
 ///   The index of the <see cref='XmlSchemaCompletionData'/> of <paramref name='val'/> in the 
 ///   <see cref='XmlSchemaCompletionDataCollection'/>, if found; otherwise, -1.
 /// </returns>
 /// <seealso cref='XmlSchemaCompletionDataCollection.Contains'/>
 public int IndexOf(XmlSchemaCompletionData val)
 {
     return List.IndexOf(val);
 }
 /// <summary>
 ///   Copies the <see cref='XmlSchemaCompletionDataCollection'/> values to a one-dimensional <see cref='Array'/> instance at the 
 ///    specified index.
 /// </summary>
 /// <param name='array'>The one-dimensional <see cref='Array'/> that is the destination of the values copied from <see cref='XmlSchemaCompletionDataCollection'/>.</param>
 /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
 /// <exception cref='ArgumentException'>
 ///   <para><paramref name='array'/> is multidimensional.</para>
 ///   <para>-or-</para>
 ///   <para>The number of elements in the <see cref='XmlSchemaCompletionDataCollection'/> is greater than
 ///         the available space between <paramref name='index'/> and the end of
 ///         <paramref name='array'/>.</para>
 /// </exception>
 /// <exception cref='ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
 /// <exception cref='ArgumentOutOfRangeException'><paramref name='index'/> is less than <paramref name='array'/>'s lowbound. </exception>
 /// <seealso cref='Array'/>
 public void CopyTo(XmlSchemaCompletionData[] array, int index)
 {
     List.CopyTo(array, index);
 }
 /// <summary>
 ///   Gets a value indicating whether the 
 ///    <see cref='XmlSchemaCompletionDataCollection'/> contains the specified <see cref='XmlSchemaCompletionData'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to locate.</param>
 /// <returns>
 /// <see langword='true'/> if the <see cref='XmlSchemaCompletionData'/> is contained in the collection; 
 ///   otherwise, <see langword='false'/>.
 /// </returns>
 /// <seealso cref='XmlSchemaCompletionDataCollection.IndexOf'/>
 public bool Contains(XmlSchemaCompletionData val)
 {
     return List.Contains(val);
 }
 /// <summary>
 ///   Copies the elements of an array to the end of the <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>
 ///    An array of type <see cref='XmlSchemaCompletionData'/> containing the objects to add to the collection.
 /// </param>
 /// <seealso cref='XmlSchemaCompletionDataCollection.Add'/>
 public void AddRange(XmlSchemaCompletionData[] val)
 {
     for (int i = 0; i < val.Length; i++)
     {
         this.Add(val[i]);
     }
 }
 /// <summary>
 ///   Adds a <see cref='XmlSchemaCompletionData'/> with the specified value to the 
 ///   <see cref='XmlSchemaCompletionDataCollection'/>.
 /// </summary>
 /// <param name='val'>The <see cref='XmlSchemaCompletionData'/> to add.</param>
 /// <returns>The index at which the new element was inserted.</returns>
 public int Add(XmlSchemaCompletionData val)
 {
     return List.Add(val);
 }