Last post Nov 04, 2015 11:44 PM by JohZant
Nov 04, 2015 07:19 PM|JohZant|LINK
Some errors in Visual Studio are the most helpful things with telling me how to solve it, but others are pure evil.
I am trying to build an XmlDocument for a list of items that my code needs to process.
There is a method that brings back a list of items such as below;
This result gets returned to me as an XmlElement.
XmlElement searchResult = returnSearchResult();
The 'returnSearchResult' method gets returned multiple times. What I need to do is grab all the 'item' elements from the searchResult file and append it to my XmlDocument.
Hopefully I have made a bit of sense. The only thing that I can't change is how the method 'returnSearchResult()' returns the result. The rest is my code and I can play around with it.
Nov 04, 2015 11:44 PM|JohZant|LINK
Over 4 hours, slipping ASP.NET community. haha.
After a lot if frustration I have fixed my problem.
XmlNodeList searchResultNodes = searchResult.ChildNodes;
foreach (XmlNode node in searchResultNodes)
XmlElement nodeXml = GetElement(node.OuterXml);
The main thing that I was missing was the importnode. This has solved all my problems.
Until next time I try and do silly things.... which will probably be tomorrow, let's be honest with ourselves.