C
C#2y ago
reeeeeee

Parse XML response (nested path)

Currently have this:
xmlResponse = XElement.Parse(stringData);

XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlResponse.ToString());

json = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
xmlResponse = XElement.Parse(stringData);

XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlResponse.ToString());

json = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
Then I would like to get just that inner part of the xml
var jsonPart = json.SelectToken("FODepartment.FODepartment");
var jsonPart = json.SelectToken("FODepartment.FODepartment");
Because my XML has some inner array FODepartment with FODepartment objects (a bit weird, ik). Is there a way to get a list of those FODepartment objects directly? Or would I need to specify a whole path (which is something like multimap:Messages.multimap:Message2.FODepartment, but I would rather have just those FODepartment.FODepartment if is possible) And should I parse it in any other way, than transforming from XElement-XmlDOcument-Jobject..)
1 Reply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View