Last post Jul 25, 2018 07:14 PM by mudassarkhan
Jul 25, 2018 06:15 PM|cfcorp|LINK
Ive was wondering if its possible to use ASP.net and to display the entries of an XML on the aspx page and code behind. What i am trying to do is display information from a simple XML file that contains nodes called " name, address, gender" dynamically.
So if someone opened the page it would list the entires of the XML file to read as below? I wasnt too keen on the list view entry as I was also looking to add a placeholder image to each entry to represent gender, so if for example gender was Female then
a female silhoutte would appear to the left of each record.
Can anyone offer any guidance or help? Greatly appreciate it!!
Name: Jane Doe
Address: 123 Fake street
Name: John Doe
Jul 25, 2018 06:55 PM|mgebhard|LINK
ASP.NET has very mature XML APIs and Visual Studio comes very robust XML tools. A common programming pattern is deserializing XML into a C# type. Then you just dealing with an object.
It's very easy to create the type of you have the XML. Copy the XML doc. Open a cs file in Visual Studio. Click Edit -> Paste Special -> Paste XML as classes.
Linq to XML is another approach which provides very robust XML query facilities.
Finally there's the XmlDocument and
XDocument APIs. These allow you to load and manipulate XML documents.
Take some time to go through the links and learn the technology. Then pick an approach that fits your needs.
Jul 25, 2018 07:14 PM|mudassarkhan|LINK
XPath Example: Select XML nodes by Name and Attribute values in C# and VB.Net
XPath: Select all Nodes with Name using XPath in C# and VB.Net
XPath: Select all Nodes with Attribute value using
XPath in C# and VB.Net