/// <summary> /// Finds the schema given the xml element path. /// </summary> public XmlSchemaCompletionData FindSchema(IXmlSchemaCompletionDataCollection schemaCompletionDataItems, XmlElementPath path) { if (path.Elements.Count > 0) { string namespaceUri = path.Elements[0].Namespace; if (namespaceUri.Length > 0) { return(schemaCompletionDataItems[namespaceUri]); } else if (defaultSchemaCompletionData != null) { // Use the default schema namespace if none // specified in a xml element path, otherwise // we will not find any attribute or element matches // later. foreach (QualifiedName name in path.Elements) { if (name.Namespace.Length == 0) { name.Namespace = defaultSchemaCompletionData.NamespaceUri; } } return(defaultSchemaCompletionData); } } return(null); }
/// <summary> /// Finds the schema given the xml element path. /// </summary> public XmlSchemaCompletionData FindSchema (IXmlSchemaCompletionDataCollection schemaCompletionDataItems, XmlElementPath path) { if (path.Elements.Count > 0) { string namespaceUri = path.Elements[0].Namespace; if (namespaceUri.Length > 0) { return schemaCompletionDataItems[namespaceUri]; } else if (defaultSchemaCompletionData != null) { // Use the default schema namespace if none // specified in a xml element path, otherwise // we will not find any attribute or element matches // later. foreach (QualifiedName name in path.Elements) { if (name.Namespace.Length == 0) { name.Namespace = defaultSchemaCompletionData.NamespaceUri; } } return defaultSchemaCompletionData; } } return null; }