The idea was to just select X nodes out of a pool of Y and the example here is simplified to show you the problem. In general it is like that I have a multi level xml that I needed to flat out to only have one sublevel (aka root + level1) but from the source I only need to have certain elements that are of interest to me.
Anyway the issiue is solved cos I done it with foreach cos I found out that if you have an shema specified in the xml but not accessable LINQ dosent whant to work anyway.
the solution was like this:
I made a function:
public System.Xml.XmlElement GetSubElement(XmlElement Parent, string element)
{
System.Xml.XmlElement ret = null;
if (Parent == null)
return ret;
XmlNodeList ContentNodes = Parent.GetElementsByTagName(element);
if (ContentNodes.Count > 0)
{
XmlNode node = ContentNodes.Item(0);
ret = (XmlElement)node;
}
return ret;
}
I made a foreach loop on the area that was repeating
I got the elements that where out of the repeating context with the above function.
Anyway that solved it for me.
Edit:
Don't know how to get this code to appear properly cos Ctrl+K dosent seem to do it
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…