XPath and C#: Get data from an XML Document

I show how to query an XML document with XPath in C# in this video. I start with an overview explanation of XPath, and how it can be used. Next, I implement several examples of these XPath expressions in a C# project in Visual Studio 2019. Then, I start the application in debug mode, upload an XML file, and show the results that the XPath query generates. I use several classes and techniques from System.Xml: XmlNode, XmlNodeList, XmlDocument, and InnerText.
This video is part of a playlist on integrating JSON Data APIs in C# Visual Studio 2019: • Azure Fundamentals: Ov...
Source code is freely available on GitHub at github.com/discospiff/PlantDiary

Пікірлер: 21

  • @PatrickHoodDaniel
    @PatrickHoodDaniel2 жыл бұрын

    This is the only video on XML that helped me. Very well demonstrated!!

  • @discospiff

    @discospiff

    2 жыл бұрын

    I'm glad it helped! XPath is a great way to navigate XML documents.

  • @longbeachboy57

    @longbeachboy57

    5 ай бұрын

    Same here :)

  • @discaffix6604
    @discaffix66043 жыл бұрын

    Great introduction to Xpath, I appreciate it Brandan!

  • @discospiff

    @discospiff

    3 жыл бұрын

    I'm glad it helped! It's great to hear from you.

  • @teawithcinnamon
    @teawithcinnamon3 жыл бұрын

    Thank you! This helped a lot

  • @discospiff

    @discospiff

    3 жыл бұрын

    Glad it helped, thanks for the comment! There's a lot you can do with xml parsing... a great way to validate interchange data.

  • @607
    @6072 жыл бұрын

    For some reason I thought xpath was really complicated, and I tried to avoid using it. All this time (just a few days, to be fair :P), it's been exactly what I wanted.

  • @discospiff

    @discospiff

    2 жыл бұрын

    Funny, me too! I thought XPath was complicated, until it got my hands in it and tried it... then I realized, it's quite useful, and simple! I had a similar experience with Spring Boot.

  • @davidjohns4745
    @davidjohns47452 жыл бұрын

    At last I've got to a video that gives me a simple way to query XML. I've been down some strange rabbit holes.

  • @discospiff

    @discospiff

    2 жыл бұрын

    I'm glad it helped! XPATH is a great way to filter and find data.

  • @natedietel4968
    @natedietel4968 Жыл бұрын

    Would you look at that. I'm still learning from you after graduation! Your videos are incredibly helpful, hope you're doing well!

  • @discospiff

    @discospiff

    Жыл бұрын

    Ok, this is really good to hear! One big reason I put my lectures on KZread is to keep in touch with former students. How've you been???

  • @natedietel4968

    @natedietel4968

    Жыл бұрын

    @@discospiff Doing well! I work at CIC and am working on a listener for XML files and this helped a lot!

  • @milanapegaonkar3614
    @milanapegaonkar36142 жыл бұрын

    Thanks!

  • @discospiff

    @discospiff

    2 жыл бұрын

    You're welcome! Thanks for watching.

  • @davidvillarreal5256
    @davidvillarreal52562 жыл бұрын

    Hello, good video, a question, I get this error when trying to access a node: "CLR / System.NullReferenceException" Do you know how to solve it?

  • @rayanm2175
    @rayanm21752 жыл бұрын

    hello sir, if there is a .dds file that was linked to an XML file like that "" how can i grab that file ? ,,i was able to grab some of the files using a program but the program couldn't find the rest .

  • @ViratKumar-kz7je
    @ViratKumar-kz7je2 жыл бұрын

    Can we use Xpath method in Winform c# ?

  • @discospiff

    @discospiff

    2 жыл бұрын

    I've never tried it, but I imagine you can.