I am struggling with a reasonable logical loop to extract nodes from an XML file that is too large to be used with XPath that supports .NET classes.
I am trying to replace a single line of code that I had (called SelectNodes with an XPath query string) with code that does the same but uses XmTextReader.
I need to go down several levels, as shown by the previously used XPath query (which was for reference):
ConfigurationRelease/Profiles/Profile[Name='MyProfileName']/Screens/Screen[Id='MyScreenId']/Settings/Setting[Name='MySettingName']
I thought it would be annoying, but simple. However, I just can't get the loop to the right.
I need to get a node, check the node under this to see if the value matches the target line, and then move on if this happens or skip this branch if it is not specified.
In fact, I think that my problem is that I do not know how to ignore the branch if I do not use it. I cannot let it go with irrelevant branches, because the element names are not unique (as shown in the XPath request).
I thought I could support some booleans, for example. bool expectingProfileName, which gets true when I delete the node profile. However, if this is not a specific node profile, I cannot get out of this branch.
So ... I hope this makes sense to someone ... I have been looking at the problem for a couple of hours and can just skip something obvious .....
I would like to publish part of the file, but I canβt understand what the structure looks like:
ConfigRelease > Profiles > Profile > Name > Screens > Screen > Settings > Setting > Name
I will know the file_name, instance_name, and username, and I need the node setup.
, . , . , XML , , , .
.
. XPathDocument, . Unfortunatley, , , XPathDocument .
, XmlDocument. 4 , , -, , , XmlDocument. , , , , . , DataSet, .
2
, , , . , . , , reset , . . , , , . , , , , , , - , .......