XML

XML

Show Video

Hi. Everyone. In. This video we are going to talk about XML. Previously. We talked about HTML, and the. Realize. That hTML is not good enough for. Content. It's. A good technology. For creating websites, that that are meant to be used by us as humans so we can go on the web browse, the web and read the content, of the different, web pages but. It's not good for creating documents. That, are meant to be read and understood by computers, so, computers, can do things for us for instance make. Links, and connections between, different data. And process. Them and. Do. Other things, so. HTML it. Was more about appearance, and structure, partly. Structure, than, content. And. Tags that, it had like tanks. For paragraph, or block code for more than heading, 1 and heading 2, and so, on they, didn't tell us or, tell computer, much about the content, computers. Cannot, understand, the content, of HTML, files and, HTML was, limited. And too permissive it, ignores a lot of mistakes and the roars encodings, and still, process, document, and shows the the, content of web, pages because, because. We, as human are supposed to go there, and read a document, that's. Why we need XML. Which is extensible, markup, language, it. Was developed by a, small group read led by John Bozek of Sun. Microsystems and then it became a ee, World Wide Web Consortium. Recommendation. In February 1998. It's. A method for encoding text, and other electronic, material and it. Encode the structure, of the document not. His appearance, which was the focus of HTML, and. It. Is independent. From software, and hardware so it doesn't depend on any machine or. Any application of software and it separates, the data from, the software and that's. The power XML. So. What is the example. A simple. Syntax for, defining a Markovski. So, basically, unlike, HTML that we had a predefined. Set of tags that we were supposed to use there, is no predefined. Tags in XML, we, have to create our own tanks. So, basically, XML, is a, markup, language to. Create other markup, languages, so. In. XML. You're able. To create, elements, attributes. Entities. And document. Structures. So. XML, documents, are, text. Documents, either Unicode. Or ASCII documents, with. Dot, XML. Extension. So, your plain text document you, can open them be the browser or with notepad or something like, that. Unlike. HTML. XML. Is case sensitive, so if you create a tag and open. The tag with all lowercase like title, and close the tag with, the title. T capital, then, XML. Will, consider it completely. To separate. Tanks. It will, not understand, that this is the closing and opening of the same text it will consider them as two, different types and it will result in an error all. Of the XML. Document like, HTML, document, they start with the declaration. Line that, tells the application. Or the computer, or the software, that reads the file that this is an XML, file and that's, the that's, how we do so it says XML. Version 1 encoding. Utf-8, which means this is Unicode, document, XML. Version 1 and. XML. Document structures, are like. A tree structures, so they start with the root we always have a tag. Or element, that start, it is, in the beginning of the, document also appears, at the end of the document so, we have a root element and, inside, the root element we have other another, set of elements and inside. Each element there might be other elements that's why we call it the tree, structure because, as you can see in this example for instance we have customers, and customer. Inside, the customers, element, he might have another element called, customer, ID and then contact. Name. On and so forth so, composed, of Lester the structure that's that's, the meaning of nested because one, type could be inside, another time, and.

Some. Elements may also have attributes, and. Let's. Go to attribute so attributes. Are. Things. That modify. An element right here so we have an element for name which, opens here and closes here and it has a content, which is London, but. We had the, the element has an attribute. Which. Is type and, it, modifies the element, we says the, type of this name is a place, name and it's London, attributes. Have a name and values this is the name of the attribute and this is the value of attribute and the, value is always in the quotation mark like. HTML, the. Same apply, to HTML, is. The. Basic, syntax of, XML. Is that. Documents. Are composed. Of elements and each, element is it. Is it. Is a tag which. Has an opening, and ending, and. As. It is case-sensitive so, if they should be written the same and the the, best practice the practice, is to keep everything lowercase. Unless. We want something like last. Name. Name. Like. Sometimes. You might write like this. Last. Name. To make it easier for us to it but we need to be consistent so if the, opening, is like this then the ending should be the same. Unlike. HTML end, tags, must be present so we cannot open the tag and not close it its, results, in an error in, HTML, if you forgot to close the tag so if we remove this still. The, browser would show the document document was and it would, not, give. An error. Elements. Are basically, taxed so this, is an element title. They. Can be repeated, they can be option also they can be present in the document, and if not if they don't apply we, can remove that elements. Can contain, other, elements elements. Can contain only text. And leaves. Of the trees and. Elements. Can have mixed, content including. Text or other, elements you talked. About the tributes and. So. Let's. See. What. We talked about, so. We said that, XML. Is extensible. Meaning. That we can use it to create other markup, languages if you go to Wikipedia and, type list, of XML, markup languages, you get a long. List of other markup, languages, that, have been created, using. XML. And some of them would, look familiar to, you for instance we have here mark, XML, that you. Can read it about in the textbook and. Mark external is basically, a markup, language created. Using, created, creators. Or using, XML.

To, Turn mark, documents, and present. Them in XML, language the. Other technology. Is is RSS. So. You, might be familiar with this if you go to any blog like this web blog you. Will see. RSS. And RSS you, can subscribe. To RSS and. What. Happens, is that you. Will get, notification. From that blog every, time there is a new post and a. Summary. Or the full text of that blog, post will come to your computer, read. It with whether it is your Outlook, or browser and you can see it and a and RSS. Is a. Document, like this so, you can see this, is an RSS document, it has a root element which, is channel, sorry. RSS, here opens, here and closes. Here and it, is 3 so we can 3, structure we can decide. To. See part of the document, and then, it has a set of tags including the title the. Description, link. And. Item. And so on and. This. Is also March. So, mark is machine readable, cattle. Machine-readable. Catalog, and, it has a few. Tags. For the names of the field for instance 100. Is used for author and, so. When the computer is the machine readable catalog, when, it reads. The opening. Of the line which is 100. And specific, characters, then it realize that what comes after, is the Toth author, or creator, of that catalog. Record that, information. Resource so, if we turn mark, into mark mark XML. We. Can see an example, of Mark XML, record here you, can see again it has a name. It. Has a solid. Root. Element. And then it has a few. Elements. Or tags and elements. Have. Attributes. Such as this. So. You can go and have a look at some of these other markup. Languages, that have been created by using. XML. And. If you want to learn how to write XML, again. W3schools. Is the, best place that one, of the best places that you can go to learn about XML. Now. Let's create our own, first. XML, document, so. We. Created a plain, text document and call. It my, XML. And. Then. We open this. So. The first thing we need in our XML, document, is the declaration, line so. We have this declaration. Line here. You. Can copy/paste this one, so. The first line of the document is. This. Line to tell the browser that this is browser. Or the application, that this is an XML, document then. We, need. The. Root element let's suppose I'm going to create a markup language to. Markup my. Emails and I, decided that I have I need I'm, going to have a few elements including, emails, including message. Four different emails, that I sent and sender. Recipient first, name and surname for the recipients, date, of the email subject of the email and the body of the email so, the root element.

Is. Gonna be timid. So. I have I opened, the tag of email and close the tag of email at the end of the document inside, my email or let's say emails. I'm. Going to have a few emails and. So, now I'm going to use the tag message. For, that purpose so I'm going to have one. Message. It. Opens here and closes here and one, message is going to have a sender, is going to have a recipient, and recipient, is going to have a first, name and surname and then, the, email has going is going to have a date and subject and, body. So. The sender will be Hamid and. Recipient. Will be. Let's. Say. Mary. Carol. And. Then. The date will be 12th. Of February. To. 2018. And the subject. Will be of. Course and. The. Body will be. Some. Other text right this is the first message, so, you can have a few messages or a few emails like this and. Which. Means the these elements, will be repeated, let's save this and. Then. Change. The extension of these to XML. So. This is our first XML, document, and then they open this. So. I'm going to open it with the browser. So. There is a mistake. Here. Let's. Go back to the document to see what is the mistake. This. It tells, us that there is a mistake here so. You. Can see the mistake that this is the data it says, data and this is date and. It. Gave me an error you. See here it says. Parsing. Error, mismatched. Tag, expected. Data but. It's so dead so data and data are not the same and that's why XML. Is very strict with the name of the tag so if you fix take this. And. Save. It and. Refresh. This. Then. This is the first XML, document, you create it, has a header the. Declaration. That it doesn't show up, here, it. Has a root. Element which, is emailed, and it has one, message, opens. Here and closes here and one, message has a center, and then recipient, and date, subject, body, and so on so I can repeat these messages, and have hundreds, of messages within, that document. But. As you can see we. Don't want. The. Issue is that we. Don't want anyone to create their own text because there, will be chaos for, instance in this case if other people decide to to, mark up their, own emails, they may not choose the same emails, then. Elements. For instance or. They, may not put the, information, inside the elements. The same way that I did for instance date, could be written 12. And then, instead, of this, it could be like this or. Somebody. Might decide. Instead of said writing, center they, might write from. From. And that. Means there won't be consistency, so why mark up my, mark, table emails, documents. Will, be different, from somebody else. And that's not the point of example we want consistencies. So we, can be. Exchanging. Data between different applications, and between different sources of data and. Especially. Because XML, is supposed to play, an important, role in exchange, of data and in interoperability. And so on, to. Achieve. That consistency, they. Have something called, document. Type definition or, DTD. And. DTD. Or document, type definition basically. Is a document, that. Specifies. The, rules. For. That markup, language that we created in XML, it, tells us in this markup, language that I created, for my emails they're only. These set of tags are allowed, so we have a type of message body, from. Or. Sender and so on and so forth and, it it, also specifies what. Type of content, or values, we are allowed to put inside, those. Elements. For instance in the body, you can type any character, so it can be a taste but, inside that there.

Needs To be dead in a specific format, it. Specifies. What attributes. Elements. Can have whether. Elements, are optional, whether they can be repeated, and so on so we define all of the these, rules about the, markup language that we created in, a document, that we call a document, type definition and. All of the, technology. That you see here like, these markup languages listed. Here like our SAS markup. Xml. Markets. Ml and so on they, have a DTD. Which means they, have a set of rules that have been defined and if you want to use that. Mark. XML, or RSS. You, need to follow those rules use so you cannot, create, your own tags if you use one of these technologies, if you want, to create a new markup, language then obviously you, think about it and you create your own text. But if you want to use this then, you need to use follow. The rules specified. In their DTD. And. To. Sum up so XML, is all about structure, and content, under. HTML, that was mostly, about appearance. How. If, they are the content. Is presented on the browser. So. We can read it so. Computer, can parse and understand, the. Content of the examined because the tags, are have, six self, explanatory. Note and there is also a DTD, document that, the computer reads and understanding, the, elements and the data it. Is independent. From any software or hardware, it doesn't define and depend on the browser or, the hardware or the applications. And it's very good for preserving. Data save. Once use. Many times I'm, very good for exchange of data let me give you an example for instance. This. Is a. Journal. Article from plus, plus, one is one of the more famous. Scholarly. Journals and so. The articles, can, be presented in HTML, like you can see here you, can download. The PDF / PDF might be obsolete, in 10 years time so 10 years all of the PDFs, what, they are gonna happen to them we don't know but, this, June are beasts you are on and a lot of other journals, they also publish, their articles in, XML, format and. If you go, to the XML we can see a set of Tanks for instance about. Contributor. So. You can see they the. Name of the contributor, for instance surname, and given. Name of the author you. Can see a section, about abstract. An. Abstract, has a few paragraph and so on so, if we save.

The Article, is in XML, format in 20, years time we. Can convert this XML, file to any format, that we want but if we save. All of the articles, in PDF then. If in ten years time PDF, becomes an obsolete technology we. Can't do much about it because, it's. Very hard to change. The PDF, format to another format because, the. Data is not separated, from the software and application. But in XML, it is so, we can easily write a piece of code to, extract, the information and. Content from this XML, article, and turn. It to a HTML, format, to a Word document with. Or, any other format. That evolve so you can save the article, in this format once and use. It many, many times for, any purpose, or any application for any, software. The. Other thing is that we have a. Discussion. And we have a technology. Research, about XML, information. Retrieval so if the effect if. You feed this document. Into a database. In XML, the, database, can easily pass this and we. Can retrieve information and. Instead, of retrieving, the whole document, the whole article, if you're looking for the topic then, we can retrieve only for instance the methodology. Section of this article this, is not possible in HTML, or PDF but. In XML, we can have a database we, search for a topic for, instance for headache or for something for cancer, and then, they can specify that the own I own I am only interested in the methodology. Sections. Of the, articles, and that's, the power of excitement. Because it has, nested. And tree structure, so we can specify if, we. Want information from only, a specific element or, cause of the document. Thank. You.

2018-03-24 18:40

Show Video

Other news