XML instance analysis 1

xiaoxiao2021-03-06  87

XML instance analysis

outline:

One: Example effect

Two: Example Analysis 1. Define the new identity. 2. Establish an XML document. 3. Establish a corresponding HTML file.

XML has a wide range of applications in different fields, such as Mathml, wireless communication applications in technology, SVG in network images, etc., we focus on the application of XML on the Web. The application of XML on the web is mainly used with its powerful data operation capabilities. Generally use server-side program such as JavaScript and ASP to implement almost all applications on the network.

Consider explaining convenience, we will introduce a simple example below and does not include server-side programs. The purpose is to let you have a sensibility to XML's data operation capacity.

Ok, we first [click here] to see the effects of the instance. (Please open with IE5.0 or higher browser)

This is a simple CD record data retrieval function. You can see the information about the single CD by clicking "Previous", "Next". Such an effect we used to use two methods:

1. Use DHTML to hide data in different layers, displayed by mouse events;

2. Use the background program (such as ASP, CGI, PHP, JSP, etc.) to call the server data.

But in this example, we open the page original code, where there is no DIV of DHTML, there is no form of action, which is fully implemented with XML. Let's analyze its production process:

The first step: Define the new identity. According to the actual CD data, first create an identifier named ; secondly build it related data identity, namely: CD name , singer <artist>, publishing Year <Year>, national <country> , Issued company <company> and price <price>; finally establish an identity named catalog <catalog>. Why build a <catalog> ID again? Because in the XML document, you must have a root element (identifier), we have multiple CD data, which is parallel, so you need to establish a root element for these side. The definitions and relationships of the above elements are fully compliant, and the DTD definition can be omitted without the special DTD files. If we want to use DTD to define, the above process can be represented as: <! Element Catalog (CD) *> <! Element CD (Title, Artist, Year, Country, Company, Price)> <! Element Title (#pcdata)> <! Element artist (#pcdata)> <! Element country (#pcdata)> <! Element company (#pcdata)> This code is represented: Element Catalog contains multiple CD child elements, while sub-element CDs contain Title, Artist, Year, Country, Company, Price six sub-elements, and their content is defined as text (characters, numbers, text). (Note: The specific grammatical description can look at the introduction of DTD)</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-106759.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="106759" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.033</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'XV8LrCFjYXT4KlVLmvqwecKC6eQbd0WXyT_2BcoYPhCSNhZq9RwzkKoDWwZoJAjUl_2FB4qp1ZKSFqHtZZqMdw3FxA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>