00:00All right, so let's clean up and move on to the next step,
00:02which is actually retrieving that data
00:05and seeing how we could actually access it.
00:07So let's take a first, let's take a look
00:09at how to access nodes or nodes.
00:14Well, that's really what we wanna access.
00:16Okay, so let's see how we do that.
00:18So first of all, it's incredibly simple.
00:21So first of all, if we're in the,
00:23looking at this XML that we loaded,
00:25if we even just look right now, we're in here.
00:28To access the header, all I have to do
00:30is just enter into the header.
00:32This is the way I do it.
00:35Done, now I'm in the header.
00:37Now, if I wanna go deeper in, I wanna go into the title,
00:40all I have to do is just title and there we go.
00:44And then I have direct access.
00:46I could save this and if we echo this out and test it out,
00:49well, you should see the content of that XML node.
00:54Now, if our node had a name that was illegal to PHP,
00:58such as minus is not allowed
01:00because it's part of the language,
01:01this is how we access minus and greater than,
01:04this is how we access our nodes.
01:07So what would happen if our title wasn't called title,
01:10but it was called, it had a different name.
01:12Let's say it was called my title.
01:17What would happen if our XML, from an XML perspective,
01:19this is legal, but from a PHP perspective,
01:22this is absolutely not legal.
01:24I could definitely not come here and type my title.
01:27If I would do that and I would have your PHP
01:30actually generating errors,
01:31we would see here that we're doing here
01:33something completely unexpected and unappreciated by PHP.
01:39So let's see how we could solve this.
01:40It's actually quite simple the way we solve it.
01:42We have to open up a curly bracket
01:44and close a curly bracket
01:46and then just paste inside this as a string instead.
01:49So basically it's the exact same structure as we had before,
01:52only instead of that,
01:53we're putting it in between two curly brackets.
01:56It's very similar to the way how in PHP,
01:58how in JavaScript and Flash,
02:00you would actually use an object and then put it in size.
02:03You'd use the bracket,
02:06but in our scenario, we're using a curly bracket
02:08instead of the squared bracket,
02:10which is fair enough, close enough.
02:12And in Flash, we might not have this type of syntax,
02:16but it's close enough and easy enough to understand.
02:18So not too bad, not that hard to get used to.
02:22So let's just test this out
02:23and make sure that we're actually getting our information
02:26and we're not getting our information.
02:28So let's see,
02:29because obviously we're doing here something wrong.
02:31We're not having any errors in our script,
02:34but we're not accessing the header
02:36while we were supposed to access the header.
02:38So it actually, it should have been,
02:40instead of all this, there was no title in the end
02:43and it actually was header and that should work.
02:48Because we had to put first the header and then my title
02:51and you can see the position of it really does not matter.
02:55And there we go, and we got our title back again.
02:59All right, last basic topic of accessing information
03:02is really how do we access attributes?
03:05Accessing attributes is even easier.
03:08It's actually really, really easy.
03:10So the way we access attributes,
03:12for example, if we're in the header,
03:14which we are in the header right here,
03:17and we wanted to access that attribute, which is called ATT,
03:21all right, so what we have to do is now,
03:23and we know we want to get to the attribute ATT.
03:26So all I have to do is open a squared bracket type ATT.
03:31So really the biggest difference here
03:33is that I'm not accessing with that minus N smaller
03:38than instead of that I'm accessing it
03:40as a element in the C instead as PHP calls it.
03:46So if I refresh my screen now,
03:48I could see my sample attribute.
03:49Now, please notice that a lot of programming languages
03:53would have dot ATT.
03:55Dot ATT and PHP is absolutely wrong.
03:57What dot actually means in PHP
03:59is plus for two different strings.
04:01So in this scenario, this would equal nothing,
04:04and this would probably equal ATT
04:06if it wouldn't generate an error.
04:08And if we would run this this way,
04:09we would probably get a value similar to ATT,
04:12and it's absolutely not what we want.
04:14What we actually want is to access the information
04:16and to access the information in PHP,
04:18we have two options of doing that.
04:20One is entering the indices,
04:22and the other one is using that minus N smaller than,
04:27which would go inside of its properties.
04:30All right, so that really covers
04:33the access to both nodes, elements,
04:37well, nodes that are elements and attributes,
04:39and that covers really the basis of this section.