XML Guide - XML ​​Element

xiaoxiao2021-03-05  27

The XML element is scalable, and there is associated between them.

XML elements have a simple naming rule.

XML elements are scalable

XML documents can be extended while carrying more information.

Please see the XML notebook below:

lin

ORDM

don't doget me this weekend!

Let's imagine software that can read this XML document and can interpret the software of the XML element (, , and ), which may be as follows:

Message to: linfrom: Ordmdon't forget me this weekend!

Let's envision, if the author of the note is added to this XML document, as shown below:

2002-12-24

lin

ORDM

Reminder

don't doget me this weekend!

So is the original application interrupt or collapse?

will not. The application will still interpret the , , and and other elements, and generate the same output.

XML documentation can be expanded!

XML elements are interrelated

The relationship between the XML element is a parent element and a child element.

In order to better understand the XML terminology, you must understand how the relationship between XML elements, and how the elements are described.

Imagine such a book:

Signature: XML Guide Chapter 1: XML Getting Started Introduction

What is HTML What is XML Chapter 2: XML Syntax

XML elements must have end tags XML elements must be properly nested

We can use XML documents to describe this book:

XML Guide </ Title></p> <p><prod ID = "33-657" Media = "Paper"> </ prod> <chapter> XML Getting Started</p> <p><para> What is HTML </ Para></p> <p><para> What is XML </ Para></p> <p></ chapter></p> <p><chapter> XML syntax</p> <p><PARA> XML element must have an end tag </ para></p> <p><PARA> XML element must be correctly nested </ para></p> <p></ chapter></p> <p></ book></p> <p>In the above code, the BOOK element is the root element of the XML document, the title element and the Chapter element are the child elements of the BOOK element. Book elements are the parent element of the Title element and the chapter element. Title elements, PROD elements and chapter elements are flat-level elements because they have the same parent element.</p> <p>XML element content</p> <p>XML elements have different content.</p> <p>The XML element refers to this part of the content between the beginning of the end marker from the beginning of the element.</p> <p>XML elements have element content, mixed content, simple content or empty content. Each element can have its own properties.</p> <p>In the above example, the BOOK element has an element content, and the BOOK element should contain other elements. The Chapter element has a mixed content because it contains text and other elements. The PARA element has a simple content because there is only a simple text. The PROD element is empty because he does not carry any information. In the above example, only the PROD element has attributes, the id attribute value is 33-657, and the MedIA property value is Paper.</p> <p>XML element name</p> <p>XML element naming must abide by the following rules:</p> <p>The name of the element can contain a child, numbers, and other characters. The name of the element cannot be started with a number or punctuation. The name of the element cannot be started at XML (or XML, XML, XML ...). The name of the element cannot contain spaces.</p> <p>The XML element of "invent" must also pay attention to some simple rules:</p> <p>Any name can be used, no reserved word (except XML), but should make the name of the element be readable, the name is useful to use the underscore is a nice choice.</p> <p>For example: <first_name>, <last_name>.</p> <p>Try to avoid using "-", "." Because it is possible to cause confusion.</p> <p>As long as you like the name of the elements can be very long, don't be too exaggerated. Naming should follow the principle of simple and easy-to-read, for example: <book_title> is a good name, and <the_title_of_the_book> looks like it.</p> <p>XML documents often correspond to the data sheet, we should try to make the name of the field in the database and the naming in the corresponding XML document, so that it can be easily data transform.</p> <p>Non-English / characters / strings can also be used as the name of the XML element, such as <Blue Ideal> <Classic Forum> This is a completely legal name. But some software can't support this name, so try to use English letters to name.</p> <p>Do not use ":" in the XML element name, because XML namespace needs to be used in this very special character.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-36911.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="36911" 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.039</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 = 'EVPgTjlc6x5ojh_2Bs4YpCZeEPV0RsJiB5awtQNG3cor0P1ASgZgkm98aTZ0NeR519BrFlUwm6p6QA4xmudtguEw_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>