This XML file does not appear to have any style information associated with it
Computers
Okay, in this video, I want to discuss fairly common informational message frequently encountered when dealing with XML files. Here on a desktop, I have an XML file and I can open it in a web browser in particular, this one here is a version of variant of mozzarella Firefox. So if I open the XML file here, I get to see this informational message saying that this XML file does not appear to have any style information associated with it, the document tree is shown below. And I'll thinking about what happens here, the web browser in this case version of Mozilla Firefox is actually an app for rendering web documents. HTML websites, mostly. But it also has the ability to display XML files among auto file types, right? And this message here is not an error or something, it's just for informational purposes, saying that the rendering display here because the XML file is not an HTML file, not a web document, the rendering, displayed here, is generated for the reason of the absence of a style style sheet style information layout information file. And this is supposed to inform the user viewer that this tree here is generated as a default layout or default rendering of the XML file. In particular, that this is not the result of a style or layout, but this is what the browser did as a default in order to display XML. Because XML files in themselves are just plain text files with a certain structure. If I open it in a simple editor, plain text editor or notepad app as you see it's just text. And it depends of course on the editor. If this text editor is a little bit aware of XML and also provides additional features, but these are not necessarily inherent or cost by any information or controls in the plain text file itself. This is what the applications do for rendering. So in this case, this tree here is almost like an outliner, app. And this is just the default provided by the browser here, which is usually for web documents HTML files. And this isn't an error or back or something, right? There's no reason or necessity to fix this, right? Because it could be quite fine to just look at the file at the actual data. If that's if the XML file is just used for as an extensible interchange format as a format for structuring text oriented data, right? But it could as well be that the user desires to have some layout or some rendering attached to it. There are some style applied to it. And for these purposes, there's a whole large range of ways to do this. For example, a common one is to use excess L style sheet files, excess L is a language style sheet language for also in itself written in XML. So therefore, if looking at it at a plain text editor, of course, it's also style and layout and transformational instructions expressed in XML. And I have two of these here. So what I can do, usually your operating system almost like a lot of operating systems come with a lot of this XML technology internally built in here. And there's also a lot of third party applications which allow the user to perform these steps. And there's also a large expensive professional tools which allow the same for, for example, publishers and other publishers, industry, enterprise, but these are usually pretty expensive. Or proprietary. And there's, of course, the XML technology built in in the operating system and then you have like small apps and tools for download, but you never know if it depends if that's like an official one from a trusted packet repository of your operating system distribution or if it's like an binary executable download which might be malware or a virus or something like that. And often these tools are specific for a single use case. But what I have here is one tool to do that using the internal XML technology libraries, I'm just going to run it. And it takes this index XML file, maybe I should mention some details about it. The particular XML notation here, this format, and the X file as serialized or expressed in XML, that is an index format for managing lists. So what happened here is that my tool here used the internal XML libraries of the operating system in order to take this index XML file and to generate two files the output X HTML file and HTML document as well as the Z three file. Of course, these files here, the X HTML extension file name extension in CSV, extension these are just part of the file name data on necessarily have any particular meaning in themselves, what actually matters is the bytes in the file, right? But as you can see, this is now HTML, which is actually based on SGML or in particular. GML like it's kind of HTML is like the generic standardized variant of markup languages, GML is a document oriented predecessor of it, and XML is simplified variant of the larger S two tooling. And it just so happens that the web browsers are based on that kind of format style. And therefore, they also tend to benefit from the advantages and the tooling and the tool chains. So therefore, this is like HTML, also see your lived in XML form. And therefore, if we open it, we could open it with any kind of XML, generalized tooling, but if opening it in a web browser, of course, the browser is an app for rendering these HTML documents, which also are supposed to be XML or SGML commands. And of course, this is like a common rendering here. The other file that is a CSV, output, right? And if I open if I try to open that in the browser, let me just do that with drag and drop. I'm opening a new tab here. And put this in. And here you see that the browser doesn't have a layer standard rendering for C three and therefore refuses to open it. And it gives me the download save S dialog here. Because it has a few default renderings built in here, for example, for XML files without style, or has its own default rendering for HTML files, which don't have any style information associated or applied to it. And CSV, it just gives up. It doesn't have a default rendering for it. But that doesn't really matter that much. I mean, this is this output is also just like a plain text file in this case. And I can open it with another app, which is optimized for which is able and optimized for such C three files in this case, that's the leap of his calc. And with that, I kind of, of course, open the table RCV, data and both of these are just generated from these stylesheet files, and of course you can have many different ones of these and all apply those like this is as shown before. This is the one to generate some HTML from the EN 6 input XML file and this is the one for generating C three output, right? And there could be a whole bunch of these style files each for like an excess L transformation in this excess L style sheet. Language written in XML. But these are not like you don't actually necessarily need these such a tool. Necessarily, there's also the option to browser has some built in support for applying style to such files. And I'm just going to open the plain text XML file here in the editor. And I can also just uncomment this instruction here, which the browser, browsers still support it. And it says that the type of the style sheet the style sheet language I want to use is excess L, I have a reference to the style sheet file, which is local to the index XML file. And what's what might be important is this media type, like it's like a content type or mime type, which is also important to notify the browser that the result, because it exists L transformation might generate some sort of format, but it browser doesn't necessarily track or understand or usually isn't too good in detecting the format and file type and therefore this media type is like sending it's like the content type or sending like the mime type sent to the browser to notify that the result of the transformation is supposed to be HTML. So if I open the same XML file in the browser now, okay, this is like a little bit unexpected. I don't know if I have to this didn't work, unfortunately. Let's see. I would have expected that I get the same result as this for the browser applying the star sheet file, but let me just check in firebug. Okay, so like what happened here is very unfortunate, but today, of course, there are restrictions in place which says you can not apply this style sheet file because it's a reference local to the local on your computer. And for the same origin policy, it's not allowed to load to load it and to apply it because that's a security problem because the style sheet could introduce some JavaScript which sends confidential information from defile or from real whatever from your cookies or from your browser session or local store to some other website and therefore the browser today tends to browse us tend to restrict and prevent any of these transformations, but it would work if this starchy file would be referenced from an external would be referenced from a server with an HTTP request, but even then you have the problem that the reference could be could have some get parameters in there and send potentially send or do something. Potentially send some confidential data and disclose it. And especially if the index file would also be retrieved from a server, right? And if the style sheet file belonging to the stat sheet files supposed to be applied onto the index XML file, if these two don't come from the same server, that's, of course, restricted for security reasons for a reason of the same origin policy because imagine if you obtain and retrieve the index XML file from one server and you are using a style sheet from another server, even potentially with get query parameters that is a big problem because then the auto then you could potentially send information or obtain cookie stuff about the other domain about from the other server. If there's two different ones. And that is very unfortunate because that, of course, breaks the whole breaks a lot of this whole mechanism, and it also means you have to use servers and domains and always request stuff from the server which is also bad for. Bandwidth and tracking and other reasons, so I guess the other one probably doesn't work either. But this is how you could have and would have done it usually, right? And especially if both files are local, the style sheet as well as the SD input XML file, there's actually not really a security concern here. Regarding the same origin policy, it's just browser renders being evil and trying to break all of the. Browser windows and want to do more web things and more online and cloud stuff and they are not in favor of supporting good local. Technology that is they are infrastructure that would allow this. Okay, but here's one more and this actually should probably work because in this case we are doing the same with a CSS file, which also is local. I have like a small CSS file here. This one, right? And we see our class in there. So this is another different kind of style sheet file. This time in the CSS format, right? Not excessive, but CSS. Layout style information. And in this case, this new class, I'm currently not using it. I'm just going to add it to an XML element here. I wait class as you would do in HTML. Of course, this is not a valid and the X anymore. And you would probably have a hard time trying to do that properly with today's browsers, but let's just tolerate that for a moment, not do it properly, mess up these formats and have them invalid for a moment. So if I open that now in the web browser, you see that the CSS actually is applied here and surprisingly, right? No concerns about same origin policy. Browsers just fine with local CSS files, right? And so therefore, therefore, the web browser still just kind of broken and they are getting worse. But the idea is the general idea regarding the informational message if looking at XML file without associated. Style style sheet files, layered information associated, informing the user that this here is a default rendering supplied by the browser. This doesn't isn't an error message. It's just for informational purposes. And as you see, you can apply all kinds of different style sheet files and layouts to the same XML file, right? You could have a whole library of different layouts for the same input file. So no need to be concerned or worried about this here. It's just a reminder in case if you have an XML file that you might also have some styles to apply to it, right? And also to make sure that if you have some similar tree rendering outline a like tree structure that also happens to be purple here and blue, that you do not confuse a style deliberately intentionally applied by you with the default rendering of the browser. But this is just what the browser puts in here in its own rendering. It doesn't exist in the file, it doesn't exist anywhere else except here overlaid as a notification. And that's all about that. Of course, like there's actually really cool technical technology that could be utilized and made working with this XML stuff and also you could it would be imaginable to have even more different style and layout. Formats that could be applied here, right? But yeah, I mean these are pretty common at CSS. Yeah, I mean, maybe there's a PostScript renderer or some other kind of technique, right? But okay, I mean, that's. I guess, most important aspects. Okay.