Hello, in this video we are going to take a look at getting node values for specific elements. So if I go to my XML file, got this note root node zone changes to note and inside of here, I'm going to have a node element and all this will go inside of there. We'll cut that, paste it into here. Let me sort out the indentation. And now let's create a nother note. We don't say note one or anything we just create a noble one like this.
And instead of from Batman up from the Joker, you'll be to Batman all the way to ollie queen. The Queen and the head in a new release to the Joker movies coming out in about three weeks. And I will get rid of this and get rid of this. Wow and it will be fun. So we'll go back here. We did everything.
So yeah, let's have a look at, you know what would happen now. So that is just being printed off from the print all but it doesn't know what to do because we're trying to get a two element which doesn't exist, or we can do is get, you know note, for example and that gets Batman so we could literally copy this and put this everywhere. Yeah. And if we reload it as you can see we get, you know, the first one, how do we get it for a specific one, aka you know number one, the way you do it is literally by going to note because if you don't specify which one you want to use And if there are, if there could be multiple in that sort of, you know, that sort of, you know, part in the hierarchy, then you'll get the first one, please specify basically as if it's, you know, an array like this, you will get that particular one, this should not change it, because this should just get the first one.
But if I copy and paste this and replace all these two, one now, as you can see, we get the next no information. So that's how you get node values, you know, have specific elements, because, you know, if you could have have more than one essentially, similar element in there, you're sort of defeat the purpose of using XML and you will just be creating loads of fall which you know, isn't good practice. That's it for this video. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.