XML classic question and answer
I. Html is so popular, why should I develop XML? Simply, HTML can't complete, we want the task to be completed by XML. The reason is very simple, the task to be completed by XML must be done by the yuan label language, and HTML is just an instance marking language. Before the XML release, the development of the Internet is bound by HTML as follows: 1) HTML cannot describe the data content, and this is precisely data retrieval, e-commerce must be. 2) HTML's description ability of data performance is very insufficient, such as HTML not describe the vector graphics, scientific symbols, etc., which can only be expressed by images. 3) The status of the HTML instance is the status of the language, and it is not possible to adapt to the development needs of the new tag requirements. The appearance of XML makes the above questions well. Imagine in the Internet world, if everyone speaks dialect, translation is to translate each other, it will be a world that is difficult to communicate and communicate. In the Internet world, XML is important, it is precisely because it played the "international language" role. In addition, XML has a tool for "professional terminology" that defines all walks of life. II. How to read XML in your browser? Tools for reading XML documents are generally referred to as an XML parser, also known as an XML processor. The XML processor transmits the data to the application for processing, publishing, query, or display. XML does not provide an application interface (API) to the application, it just passes the data to the application. The XML processor does not parse the non-constructed data. Netscape and Microsoft have included the XML parser in its browser. The XML developer group provides free XML readers and parsers to apply in application software or XML production software. III. Why use XML instead of html? More important reasons: 1) Author and suppliers can use XML to design their document types and do not have to be constrained by HTML. 2) Since XML hypertext link capacity is much stronger than HTML, the information content provided by XML is richer than HTML, and it is more likely to use. 3) XML provides more and better mechanisms to facilitate the information performance and optimization performance of the browser. 4) XML discards the complexity of SGML, so writing to process XML is easy. 5) The information is easy to store and reuse it. 6) The XML file can also be used in the SGML environment, not necessarily limited to use in the Web. IV. Can I create and manage XML files with Java? Yes, any programming language can be used to output data from the source document in the XML form. There have been many front and background tools that make program design and data management more convenient. The following two URLs have more detailed description: http://www.markwatson.com/xmldb_0_1.htm http://developerlife.com 5. Why is the analysis result of the XML file appears garbled? This is caused by the code problem. The XML standard specifies that the XML analyzer must support "UTF-8" and "UTF-16" encodings, and must be able to automatically distinguish these two encoded files, for other codes (including common Chinese encoding "GB2312" or "BIG5" ) Does not require support. If the XML file contains the encoding declaration, the analyzer is processed according to the encoding declared, otherwise it will be processed according to the identification result (the result of the identification is always "UTF-8" and "UTF-16").
Therefore, if the encoding of the XML file is outside of these two, you must add the encoding declaration before the XML file, such as: XML Version = "1.0" encoding = "GB2312"?> The encoding of the XML file is " GB2312 ". Existing XML analyzers do not support Chinese encoding "GB2312" or "BIG5", so the XML file containing Chinese cannot be read. You can use an analyzer that supports Chinese encoding, such as MSXML, IBMJAVA4C, IBMJAVA4J, and the like for XML analysis. You can also use the internal code conversion tool to convert the encoded to "UTF-8" or "UTF-16", then convert the resolution results back to the original encoding. The CCNV (CODE Converter) in the software garden of this site is such a tool. Of course, you can also write an internal conversion program yourself. For more information about "UTF-8" and "UTF-16" coding, check the UTF-16 and UTF-8 standards in this site standard collateral. Six. XML How to connect to the database? XML is a file format, which does not specify the connection method of the database, you need to connect the database with a traditional method, perform the database query, and then transform the query to XML format. There are now some tools to provide the XML and database connections to most of which follow this step. Below is an example of using the ASP to generate an XML file, you can visit http://www.xml.net.cn/asps/test/roster1.asp to view the execution effect. <% @ language = "vbscript"%> XML version = "1.0" encoding = "gb2312"?> Xml: stylesheet type = "text / xsl" href = ".. image oster.xsl"?> < Roster> <% set cconn = server.createObject ("AdoDb.Connection") Call Cconn.open ("DSN", "User", "PWD") SET RS = CconN.execute ("Select Distinct * from roster") Do While Not Rs.eof%>
__________________________________________________
Date 2001/01/15 />