How to display/print name value in XML file
-
I have a page in asp.net that queries an XML file and shows the data. It shows the data I need in the nodes, but I want to print the specific values deeper in the node… for instance I want to be able to print the value - PARIS or country France in the XML example below. with the line below I can only print the first element but I am not sure how to print the other values,Any advise on how this can be achieved? Note the rest of the code works and shows the other elements in the upper nodes, It s just I want to know how to display the name values or specific name value in the sample xml file below Asp.net Line Code: CityValue = node.SelectSingleNode("ns2:fields/ns2:field", nsManager).InnerText, _ XML:
EUR
3 Star
FRANCE
2.344952
48.872646
6950
PARIS
75009
-
I have a page in asp.net that queries an XML file and shows the data. It shows the data I need in the nodes, but I want to print the specific values deeper in the node… for instance I want to be able to print the value - PARIS or country France in the XML example below. with the line below I can only print the first element but I am not sure how to print the other values,Any advise on how this can be achieved? Note the rest of the code works and shows the other elements in the upper nodes, It s just I want to know how to display the name values or specific name value in the sample xml file below Asp.net Line Code: CityValue = node.SelectSingleNode("ns2:fields/ns2:field", nsManager).InnerText, _ XML:
EUR
3 Star
FRANCE
2.344952
48.872646
6950
PARIS
75009
Make sure the ns2 namespace is properly registered with the namespace manager. XmlNamespaceManager Class (System.Xml) | Microsoft Docs[^]
-
Make sure the ns2 namespace is properly registered with the namespace manager. XmlNamespaceManager Class (System.Xml) | Microsoft Docs[^]
-
I have a page in asp.net that queries an XML file and shows the data. It shows the data I need in the nodes, but I want to print the specific values deeper in the node… for instance I want to be able to print the value - PARIS or country France in the XML example below. with the line below I can only print the first element but I am not sure how to print the other values,Any advise on how this can be achieved? Note the rest of the code works and shows the other elements in the upper nodes, It s just I want to know how to display the name values or specific name value in the sample xml file below Asp.net Line Code: CityValue = node.SelectSingleNode("ns2:fields/ns2:field", nsManager).InnerText, _ XML:
EUR
3 Star
FRANCE
2.344952
48.872646
6950
PARIS
75009
Try:
CityValue = node.SelectSingleNode("ns2:fields/ns2:field[@name='city']", nsManager).InnerText
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Try:
CityValue = node.SelectSingleNode("ns2:fields/ns2:field[@name='city']", nsManager).InnerText
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I have a page in asp.net that queries an XML file and shows the data. It shows the data I need in the nodes, but I want to print the specific values deeper in the node… for instance I want to be able to print the value - PARIS or country France in the XML example below. with the line below I can only print the first element but I am not sure how to print the other values,Any advise on how this can be achieved? Note the rest of the code works and shows the other elements in the upper nodes, It s just I want to know how to display the name values or specific name value in the sample xml file below Asp.net Line Code: CityValue = node.SelectSingleNode("ns2:fields/ns2:field", nsManager).InnerText, _ XML:
EUR
3 Star
FRANCE
2.344952
48.872646
6950
PARIS
75009