[TestMethod] public void TestMethod1() { //try //{ //string result = new BoDowJonesWatchlistAutoUpdate().StartCheck(); var xmlFile = "C:\\D\\ ShareFolder\\PFA2_201703102200_D.xml"; //var xeList = ReadPFA.ReadXElements(xmlFile, "SanctionsReferencesList"); using (XmlReader reader = XmlReader.Create(xmlFile)) { //var list = ReadPFA.Load(reader); reader.MoveToContent(); while (!reader.EOF) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "SanctionsReferencesList") { //string content = reader.ReadInnerXml(); //string formated = string.Format("<SanctionsReferencesList>{0}</SanctionsReferencesList>", content); //XElement xEl = XElement.Parse(formated); //XElement xEl = XElement.Load(reader); XElement xEl = XElement.ReadFrom(reader) as XElement; //IEnumerable<XElement> querys = from el in xEl.Elements("ReferenceName").Elements() // select el; var t1 = xEl.HasAttributes; var t2 = xEl.HasElements; var t3 = xEl.Elements(); IEnumerable<XElement> querys = from el in xEl.Elements() select el; var sanctionsReferencesList = GetSanctionsReferencesList(querys); GetDistinctList(sanctionsReferencesList); } } } } //} //catch //{ // throw; //} }
标签:xml,el,6G,XElement,xEl,reader,var From: https://www.cnblogs.com/hofmann/p/16643181.html