• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Unable to get element in XML

Resolved: Unable to get element in XML

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Above XML is standard VILT Create Event xml and I need to populate it with proper data.
The issue is I am able to get “securityContent” element using below code and node holds total count of child elements that is 4:
But when I try to get another node i.e. “metaData” then I get Count 0 and way to getting element is exactly same except the path to the element.
Below is sample code that I’ve tried but not working:
Anybody has any idea what is wrong with above code and how can I make it working?

Answer:

The bodyContent node has a default namespace which applies to it and all its children.
You need to add it to the NamespaceManager and then use it in the XPath
dotnetfiddle

If you have better answer, please add a comment about this, thank you!

c# xml xmlelement xmlnode
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to scroll bottom of div at launch?

02/04/2023

Resolved: how to get and read an xml file in a zip file using xml.etree

02/04/2023

Resolved: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. cors error not resolving

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.