/// <summary> /// An xml element path is considered to be equal if /// each path item has the same name and namespace. /// </summary> public override bool Equals(object obj) { XmlElementInformation rhsPath = obj as XmlElementInformation; if (rhsPath == null) { return(false); } return(elements.Equals(rhsPath.elements)); }
public List <Tuple <string, string> > ProvidePossibleAttributesAutocomplete(XmlElementInformation path) { List <Tuple <string, string> > result = new List <Tuple <string, string> >(); if (path.IsEmpty) { var xsdResultForGivenElementPath = XsdInformation.FirstOrDefault(x => x.IsRoot); if (xsdResultForGivenElementPath != null) { foreach (var xsdInformationAttribute in xsdResultForGivenElementPath.Attributes) { result.Add(new Tuple <string, string>(xsdInformationAttribute.Name, xsdInformationAttribute.DataType)); } } } else { StringBuilder xpath = new StringBuilder(); xpath.Append("/"); foreach (var element in path.Elements) { xpath.Append("/" + element.Name); } var xsdResultForGivenElementPath = XsdInformation.FirstOrDefault(x => x.XPathLikeKey.ToLowerInvariant() == xpath.ToString().ToLowerInvariant()); if (xsdResultForGivenElementPath != null) { foreach (var xsdInformationAttribute in xsdResultForGivenElementPath.Attributes) { result.Add(new Tuple <string, string>(xsdInformationAttribute.Name, xsdInformationAttribute.DataType)); } } } return(result); }