XML SCHEMA full contact

zhaozj2021-02-08  234

XML SCHEMA full contact

Time: 2001/05/13 19:21 Author: onecenter Chinese XML Union

On May 2, 2001, after more than three years, XML's Schema finally became a fruit. In this way, XML, XML Schema and Namespace have become a formal standard for W3C. This is a historic moment worth celebrating, meaning XML syntax specification has laid a solid foundation. China XML Alliance introduces you the latest XML Schema standard and its application in MSXML 4.0.

XML Definition Language: DTD, XDR and XSD XML Schema's Sepament Use XSD Verify XML XML Schema and Name XML Definition Language: DTD, XDR and XSD We know that XML documents are formatted in format and have two constraints. The format is well suited for all XML documents, that is, to meet the provisions of the format in the XML standard. The XML document is called a valid XML document when the XML document satisfies certain semantic constraints. Currently used XML definition languages ​​have DTD, XDR, and XSD. The Document Type Definition (DTD) Document Type Defines the content mode of the various elements in the XML document with independent grammar different from XML. This language directly follows the method of defining the SGML language. DTD allows the XML document to maintain consistent DTD to share DTD provides the formation and complete definition of XML communication. Each XML document has a single DTD to limit SCHEMA-like DTD, and Schema can specify a structure or model of a particular document. Using the SCHEMA language to describe the following benefits: SCHEMA uses XML syntax SCHEMA can use XML parsers to parse SCHEMA allows global elements (in the same way in the entire XML document) and local elements (Elements) There are different meanings in a particular context) SCHEMA provides a wealth of data types (such as integer, Boolean, date type, etc.); and the data type in an element can be regulated, and can even customize data type XDR xdr as needed. The full name is XML-Data Reduced Language, which is a branch that defines the XML language that is derived by the draft of XML-DATA. Since Microsoft proposes XML-DATA, and XDR is also widely used in its software after the application is revised. The products currently support XDR Schema include: Microsoft BizTalk Server Microsoft SQL Server 2000 Microsoft Office 2000 Microsoft IE5.0 and subsequent version XDR also gave support for ExtensIlity XML Authority Editing tools. XSD Schema's most formal XML Schema language is the XML Schema specification specified by W3C, referred to as XSD (XML Schema Definition). XSD also provides a method of support and structural definitions of data types. On May 2, 2001, the XML Schema specification became the formal recommendation standard for W3C. This means that after more than three years of development, XML's Schema standard finally repaired. In this way, XML, XML Schema and Namespace have become the formal of W3C. This is a historic moment worth celebrating, meaning the XML syntax specification has laid a solid foundation. The extensive development and application of XML will become a reality. Below we will focus on the latest XML Schema standard.

XML Schema's full picture

We use the actual example to introduce XML Schema's usage. For example, there is such an XML instance document: to Zunbao Male 001 1576-3-2 Baijingjing Female 002 1578-4-25 This document is defined by DTD as follows: But the data type of the text elements such as Name and Genda, SID is a unified character type, and in fact, we generally require a more stringent restrictions on them. For example, ask NAME to still be a character type, while genda is an optional enumeration type, can only take a male or female, SID requirement is a three-digit integer type, and requires Birthday to date. Name and birthday definitions are relatively simple: Where string and Date type are the basic data types from SCHEMA (Primary Data Type). Minoccurs and maxoccurs are at least maximum number of times, which is indicated and only once. This is the easiest element declaration. Two data types are available in XML Schema: One is the basic data type we just contact or is called built-in data type; another is the extension data type, which is both the user's own scaled data type on the basis of the basic data type. There is no specified gender type in Schema, nor directly specifying the data type of three integers, but gender is an enumeration type of male and two choices; each of the SID is non-negative, so we can define two Class extension data types, then restrict GENDA and SID elements.

has the element of the most basic four text content, how to define the STUDENT element of its parent element? Since the Student element is composed of sub-elements, it is called its bit complex type element in Schema.

Moreover, its sub-elements are sequences of sequence, so this declaration Student element: additional studentlst elements contains the Student element, and The way is one or more, or may not appear, the way in Schema can be expressed by mioccurs and maxoccurs: Finally we will include these elements and data types of statements in the Schema root element Medium:

Use XSD check XML by XML Schema, you can use to verify the semantics and structure of the XML document. The MSXML 4.0 technology preview version has provided features with XSD Schema to verify the XML document. When you check the document, add Schema to the XMLschemacche object, set its object, SET The Schemas Property of A DomDocument object's Schemas property references to Schema in the XMLscheMacche object. The check operation is automatically performed when the XML document is loaded into the DomDocument object. We may use examples to explain how to implement an XML document check by programming in Visual Basic. These include: Books.xsd Schema books.xml used to verify the books.xml file will be loaded and the Books.xsd controls the Visual Basic check code to create an XMLSChemacache object, add Schema to it, then Set the Shemas property of the Schemas Property of the Domdocument object. In the beginning, you have to do the following: Open Visual Basic 6.0, select the Standard Exe New project Select References in the Project menu. Select Microsoft XML in the Available References list, V4.0 Add a Command button to Form1 to store the item books XML enters the following XML code in the XML editor or even a normal text editor, and stores Books.xml: Gambardella, matthew XML Developer's Guide </ title> <genre> Computer </ genre> <price> 44.95 </ price> <public_date> 2000-10-01 </ publish_date> <description> An in-depth look at create, applications with xml. </ description> <title> 2000-10-01 </ title> </ book> </ x: catalog> Books.xsd below is this Books.xsd schema used in Example.</p> <p><xsd: schema xmlns: xsd = "http://www.w3.org/2001/xmlschema"> <xsd: element name = "catalog" type = "catalogdata" /> <xsd: complexType name = "catalogData"> <xsd: sequence> <xsd: element name = "book" type = "bookdata" minoccurs = "0" maxoccurs = "unbounded" /> </ xsd: sequence> </ xsd: complexType> <xsd: complexType name = " BookData> <xsd: sequence> <xsd: element name = "author" type = "xsd: string" /> <xsd: element name = "title" type = "xsd: string" /> <xsd: element name = "genre" type = "xsd: String" /> <xsd: element name = "price" type = "xsd: float" /> <xsd: element name = "publish_date" type = "xsd: date" /> <xsd : Element name = "description" type = "xsd: string" /> </ xsd: sequence> <xsd: attribute name = "id" type = "xsd: string" /> </ xsd: complexType> </ xsd: schema> Visual Basic check code you can run the following examples: the following code to the Command1_Click copy process Private Sub Command1_Click () Dim xmlschema As MSXML2.XMLSchemaCacheSet xmlschema = New MSXML2.XMLSchemaCachexmlschema.Add "urn: books", App.Path & "/books.xsd"dim xmldom as msxml2.domdocumentset xmldom = new msxml2.domdocument set xmldom.schemas = xmlschemaxmldom.a sync = Falsexmldom.Load App.Path & "/books.xml"If xmldom.parseError.errorCode <> 0 ThenMsgBox xmldom.parseError.errorCode &" "& xmldom.parseError.reasonElseMsgBox" No Error "End IfEnd Sub executes the program, Then click the Command1 button and will return "No ErrorS"</p> <p>Messages XML Schema and Name Scherma are a collection of rules (also known as syntax or loubo), including type definitions (simple and complex types), and elements and attribute declarations. Different elements and properties may be described in XML, there is a need to use a named domain and a prefix to avoid ambiguity between elements and attribute statements. When you use Schema from multiple domains, the distinction element and attribute name are the most basic work. A name domain usually has a string to distinguishes each other, such as "http://www.xml.org.cn", "http://www.w3c.org/2001/ Xmlschema "and" UUID: 1234567890 ". XML Schema's preamble XML Schema is some introductory, which is the formal statement. Three optional properties may contain three options in the introduction of the SCHEMA element. For example, the SChema element used by the following syntax references three most commonly used named domains: <schema XMLns = "http://www.w3c.org/2001/xmlschema" xmlns: xsd = "http: // www. W3c.org/2001/xmlschema_Dattypes "XMLns: XSI =" http://www.w3c.org/2001/xmlschema-instances "Version" 1.0 "> </ schema> The first two attributes are identified with an XML name Two XML Schema Specifications in W3C. The first XMLNs property contains basic XML Schema elements such as Element, Attribute, ComplexType, Group, SimpleType, and so on. The second XMLNS attribute defines the standard type of XML Schema property, such as String, Float, Integer, and so on. The default name domain has a top-level Schema (XSD) element for any XML Schema definition document (XSD). Moreover, the Schema (XSD) element definition must contain the following name: http://www.w3.org/2001/xmlschema as the identifier of the name (in the declaration as an element or attribute prefix), you may not Use XSD or XSI. We look at the named domains related to the XSD and XML instance documents. For example, the preface to Student.xsd is like this: <schema xmlns = "http://www.w3.org/2001/xmlschema" xmlns: sl = "http://www.xml.org.cn/namespaces/ StudENTLIST "TargetNamespace =" http://www.xml.org.cn/namespaces/studentlist "> Here, the TargetNameSpace property indicates the URI of the name domain corresponding to the SHEMA. That is to say, in other documents that reference the Schema, the name is to be declared, and its URI should be the attribute value of TargetNameSpace. For example, because of the extended data type defined by Student.xsd yourself, the named domain XMLns: SL = "http://www.xml.org.cn/namespaces/studentlist" is also declared.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-1822.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="1822" 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.032</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 = 'Q4DbNv2fl2LbFzchgvRrp5VqeQzl59iKCHgpfi_2FBOY89UD2oeXWMfyj1Ti1WP55bgGdKE9TR2HLswRg53tWcGQ_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>