02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

XML as a Remote

One of the biggest advantages of XML use as a standard for information and configuration data units is the property of interoperability and portability of applications. The boundaries of language, platform and geographical disparities can easily be overcome by using international standards for software and hardware design.

Being a standard is not only a cool thing to say. An old standard like XML is so powerful mainly because XML doesn't depend on a language. While you might need to rebuild an application you can still use the same xml structure to access information. The separation of your data into a format that is standardized means that you can build your site off the same xml data feed as your RSS feeds, build an Iphone, Android or another application without needing to recreate your data. All you need to do is access the same data and parse the information to be used in each application separately. One of XML's major strengths is the level of support it has in most modern languages.

This is exactly the role played by XML, when it comes to client-server software interactions. Client software such as a browser makes a request and sends information in XML format to the server program, which responds and provides information as a service, also in XML format. The client could be written in Python and the server in Java, but they can be connected to perform a task. They do not directly make method calls to invoke software functionality, which is not practically feasible. Instead, they maintain message boxes, and deposit and withdraw XML messages to and from these boxes, figuratively speaking!

Video Transcript

00:00We've been through a lot so far, but at this stage. It's time for us to actually look at XML and see it's
00:07another facet another way of working with XML and what's really cool is that the syntax of XML is the exact same thing but
00:14We're gonna learn another layer of when is XML important
00:17And I decided to call this as XML as remote and you'll understand why in a second
00:22So let's first ask a few questions of first of all what what do we mean here?
00:26What is an XML as remote? So obviously we have to ask ourselves
00:31Before we price should understand what it is. We're gonna ask why we're gonna ask when are we gonna use it?
00:36And we're gonna ask to how to use it. So let's talk about this remote
00:39Really the hope in a in a very very quick brief way of saying it and then we'll get back to it in a minute
00:45It's really saying when we have two people that are speaking in completely different languages or in our scenario two different
00:51applications if we have a server side code or two client side codes or just different codes and
00:57Different teams that are working. How could we make sure that everyone is leaning on the same information?
01:02And you guessed that XML is one of those really fantastic ways to
01:08Simplify communication now, we're gonna see why that is. So first of all, let's let's treat XML in the next section as a mediator language
01:17We're basically gonna use XML anytime when we have two things that just don't know how to communicate with each other
01:24Such as if you have a developer that knows Java the developer that knows flash and they don't really have nothing in common
01:31Now if they have XML as a common language, they could now communicate with each other what they couldn't before
01:38Now when your data when do you use it?
01:41This is really like we're saying that when we're integrating between other languages now
01:45A lot of times when you're working in larger companies, you're working in larger projects
01:49This is exactly what's going to happen
01:51You're gonna have a guy that's gonna be working on the server and you're gonna have a guy that's gonna be working on the client
01:56or you're gonna have a
01:58JavaScript HTML side and then a PHP side you're gonna have a flash side and a cold fusion side you're gonna have a
02:06You could have even scenarios where you have two different client side languages communicating with each other
02:12such as let's say flash and JavaScript or you might have a desktop application that communicates with the server to fetch information about the
02:19user and so on and so forth, so
02:23Obviously
02:24No matter where we go if we're gonna decide that we're gonna use XML as our mediator language as that language is that
02:31international language which in our real world is English such as if a Finnish person and
02:37Jordanian person meet they will probably speak in English with each other
02:42All right, and that's really the whole point of XML XML in a way is not
02:46It's beyond all this stuff that we talked about until now XML is also this really fantastic
02:51Global it's not even a language, right?
02:53we see it's a syntax that enables us to store information and organize it in a hierarchy and
02:58Organize it in a tree
03:00So really our our means is basically when we want to send information from one application that speaks in one language and another application
03:07That speaks into a completely different language. We have XML as our means of working with it
03:12So so far we've seen how to work with XML and language is just had built-in XML some languages don't
03:19And as we cross over to the server
03:21It's gonna be more common to have a few different libraries instead of just having one way of working with XML
03:27So really one of your first projects your due diligence is to find the easiest the API with to work with the language
03:33That you're using on the server now
03:35Obviously if you're not gonna do any of the server work, you don't have to worry about it
03:39All you have to do is communicate with your server side guy
03:42What will that XML have so the XML guy will know how to build that out for you?
03:46And you'll be able to fetch the information
03:49Alright, and vice versa. So you have a client guy the exact same only in the other way around. So let's take a little
03:57Dive deep into this concept. So let's look at two scenarios
04:02So let's see this scenario where we need a mediator in this case
04:05I decided that this picture is illustrating two things one
04:08We have our client which is code that's built on the client side and then we have our server side code
04:13So just for example a few client side codes HTML 5 flash JavaScript on the server
04:19It could be PHP net cold fusion and many many many other languages
04:24And obviously this this break between client and server is not necessarily the reality
04:29But it's a great scenario because it's very common where you're gonna have two developers
04:34One is on the server or sometimes you won't even have access to the developer such as if you're a client side developer
04:40And you're trying to integrate a RSS feed and RSS feed is really just XML or you're on the client side
04:47And you're trying to integrate a web service a web service is the exact same thing
04:53A web service is basically XML data and you just need to know how to communicate with it
04:57So really XML is this language now if you have never heard of RSS you never heard of web services
05:03It's fine. Give it whatever name you want end of the day. There's this there's a code on the server the server generates an
05:10XML based on the client's request and
05:13Then the client have act has access to the information in a way that it knows how to read which is XML
05:19Alright, so let's take a little dive a little bit deeper into this and at this stage word. We're done with these
05:26Illustrations, let's look at what would happen if we didn't have XML now if we didn't have XML
05:31basically if we'd have two different languages a and B and they were communicating with each with each other without the usage of XML
05:38What would basically be the biggest problem with this it might work?
05:42One one thing is that these two applications now are so codependent on each other now
05:48We could bring a lot of different scenarios a lot of different things that could create issues one a needs to really understand
05:55Program B and P B needs to really understand program a they need to both
06:00Both developers need to understand the languages that each of developers working on it's harder to debug if there's an issue in the code
06:06it's much much harder to figure out who's to blame and
06:11obviously, there's security issues as soon as both applications are exposed to each other more than they need to there's there's a threat that maybe
06:19Someone that could penetrate into application a will have access then to be and vice versa
06:24So really by by not having something in between by not having this layer in between to protect us
06:32It makes our information much more vulnerable now
06:35There's a lot more other there's a lot other reasons why you would want to use XML
06:39Where why you wouldn't want to actually have applications in different languages communicating with each other directly too often unless you really need to
06:47Or unless you have another technology that would enable you to work with it
06:51But really you really want some sort of API some sort of a gateway and in our scenario
06:55When we're looking at this if we take our a and B and we just like move them up and look at it in our scenario
07:00if we're looking at this when B could generate an XML which a could fetch a
07:06Could generate an XML which B could fetch now. What did that do a
07:11Had to translate whatever we wanted to say into an XML now
07:15It's not part of its application and it moves on to be now
07:19What did that do it makes it easier to test and see okay?
07:22If this XML is formatted correctly
07:24There's an issue at B if the XML is formatted not formatted correctly
07:28then there's an issue in whoever sent that XML and
07:32Beyond that if for example application a is terminated and application B is created
07:38We don't have to worry about the inside mechanisms of B of A of the new one which we'll call C
07:44All we have to do is make sure that it's gateways its communications with the world are the same
07:51All right, so in a way. It's almost it's exact same scenario where if I just say
07:56If I have two people talking with each other, I can't just randomly come and have someone
08:02Separate them and start a new start to continue the conversation
08:06Well on the other hand if I have two jobs
08:08What is a job actually a job that defines the roles and responsibilities of that employee?
08:15Now whenever we need to replace that employee
08:18Unfortunately in this day and age it seems like it happens more often than we'd want it to happen. What are you actually doing here?
08:24we're actually
08:26Taking out the user, but we're keeping that that layer of communication and expectations from that from that new employee
08:34So this new employee really knows already
08:36He could do whatever he wants to do but at the end of the day he needs to send out information
08:40Retrieve information in the same way as his last employee was there and obviously in code. It's a lot more
08:45Strict than in the real world, but that's really basically all they really need to know to understand this whole world new
08:53Medium that we're talking about is XML as a mediator
08:56Now in our next videos
08:58We're going to jump into the server side code and start implementing it and start building out and seeing how to actually find that
09:05API that we need to work in a language such as PHP and that will wrap our topic of
09:11Working with the basics of XML and knowing how to work with it in an array of languages

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!