XML Introductory Question _xml basics

Source: Internet
Author: User
Tags trim xml parser xml stylesheet xsl
What is a slogan?
----------------------

The language of our daily writing is called the written natural language. If in a written natural language to identify certain information, and add some tags, this written natural language can be called the Markup Language (English: Markup Language). For example, in a written language, in order to illustrate the importance of a particular sentence, underline the words below. However, the markup language we explain here is actually a set language designed for computer processing, where the tags used are often expressed in words or numbers that represent a certain meaning. The usual practice is to define a set of help tokens as needed, and then add the tags to the written language to make the written language a slogan.

For example, in order for computers to understand that part of a written language is the title, that part is the author's name, and that part is the body, we define the following set of tags:

< title >, </title >;< author >, </author >;< text >, </body > Then, we can rewrite the above written language into a slogan:

< title > What is a slogan? </title >

< author >xml.net.cn</>

< BODY > The language of our daily writing is called the written natural language. ... </body >

The standard language, different from the general control flow programming language, can be regarded as a document structure description language of data flow basically. In the process of computer processing, markup language can be used as data or as a control statement.

In computer program language, the definition of a language is generally called a certain programming language, and the text written in this language is called a certain language program. To apply this habit, we refer to the definition of the standard language as a certain language, and the text written in such a language paragraph, called a certain language document. If we refer to the set of tags defined above as the "Article Markup Language", then the following paragraph labeled language, can be called "Article Markup Language document."


----------------------

What is SGML?

----------------------

In literal terms, SGML (Standard generalized Markup language--standard general-purpose language) is a calibration language, and in fact it is a common document structure descriptor language, which is mainly used to define the logical and physical class structure of the document model. SGML was ISO 8879 International standard issued by ISO in 1986.

An SGML language program that consists of three parts: a syntax definition, a file type definition (dtd--definition type document), and a file instance. A syntax definition that defines the syntax structure of a file type definition and a file instance; A file type definition that defines the structure of the file instance and the element type that makes up the structure. The file instance is the main part of the SGML language program.

In the actual use of SGML, each particular DTD defines a type of file. For example, all news articles can use the same DTD. Thus, it is customary to refer to the SGML language, which has a particular DTD, as a certain slogan. For example, an HTML language for the Internet. So SGML becomes the meta language of those derived languages.


----------------------

What is XML?

----------------------
XML is the abbreviation for Extensible Markup Language (extensible Subscript language), a standard published by the Consortium in February 1998. The purpose of the World Wide Web organization to develop XML standards is to define a standard for exchanging data on the Internet. The World Wide Web has adopted a simplified SGML strategy, which, based on SGML, removes the syntax definition section, simplifies the DTD section appropriately, and adds some special components of the Internet. As a result, XML is also a subscript language and is basically a subset of SGML. Because XML also has a DTD, XML can also be used as a meta language to derive other subscript languages.
----------------------

What is HTML?

----------------------
HTML is an acronym for Hypertext Markup Language (Hypertext Markup Language), an example of SGML, a standard published by the World Wide Web organization and a slogan designed specifically for posting information on the Internet.
----------------------

What is the relationship between XML, SGML, and HTML?

----------------------
HTML is an instance of SGML, and its DTD is fixed as a standard, so HTML cannot be used as a meta language to define other markup languages. XML is a subset of SGML, and strictly speaking, XML is also SGML. Unlike HTML, XML has a DTD, and it can also be used as a meta language, as SGML, to define other file systems, or to call other banner statements. SGML and XML are Meta markup languages if the markup language is divided into Meta and instance markup languages, while HTML and XML-derived XHTML are instances of the slogan.
----------------------

What is the purpose of XML?

----------------------
On the Internet, there is a large amount of data to be exchanged between server and server, server and browser, especially in electronic commerce. These exchanged data are required to explain the content and presentation of the data, and it would be appropriate to assume the task with the standard language. It should be said that SGML can fully play the role of the standard language of data exchange on the Internet, but because SGML is too complex for Internet applications, it requires a label language that can be used as a meta language, as SGML does, and can be handled fairly simply. In this context, XML emerges. Therefore, the use of XML in the Internet world is mainly two, one is as a meta standard language, the definition of various instances of standard language standards, the second is as a standard exchange language, assume the role of describing the exchange of data.
----------------------

HTML has become so popular, why do you want to develop XML?

----------------------

Simply put, HTML can't be done, we want the XML to do the task. The reason is simple, the task that the XML is to complete must be done by the Meta Markup Language, and HTML is just an instance of the banner statement. Prior to the release of XML, the development of the Internet was constrained by several issues of HTML:

1 HTML can not describe the content of the data, which is precisely the data retrieval, E-commerce is necessary.

2 HTML description of the data performance is not enough, such as HTML can not describe vector graphics, scientific symbols and other objects, at present only through the image to represent these objects.

3 The position of HTML instance Markup language is completely unable to meet the needs of the development of new labeling requirements.

The emergence of XML, so that the above problems are well resolved.


----------------------

How does XML simplify SGML?

----------------------
To simplify Sgml,xml redefine some of the internal values and parameters of SGML, and delete a large number of complex, infrequently used, complicated programming features (see HTTP://WWW.W3.ORG/TR/NOTE-SGML-XML-971215).
----------------------

Can you define your own file type (DTD) in XML?

----------------------
The answer is yes. This is where XML differs most from HTML.
----------------------

Who is responsible for XML?

----------------------
XML is a project of the World Business Organization, XML specification is developed by the XML Working Group of the Consortium, which consists of experts and collaborators from various fields, companies, and exchanges information through e_mail ways for modification and improvement. XML is the crystallization of collective wisdom, not the patent of a company. The 1.0 edition specification is approved by the consortium and is formally recommended for use on February 10, 1998.
----------------------

Why is XML so important?

----------------------
Imagine that in the Internet world, if we all speak dialects and exchange information with each other to translate, it will be a very difficult to communicate and communicate in the world. In the Internet world, XML is important, precisely because it plays the role of "international language". In addition, XML provides a tool for defining "jargon" in all walks of life in a more internet world.

----------------------

What is a document type definition (DTD)?

----------------------
A document type definition (DTD) is a set of syntax rules about markers. It tells you which tags you can use in your document, what order they should appear in, which tags can appear in other markers, which tags have attributes, and so on. The DTD was originally developed for use with SGML, it can be part of an XML document, but it is usually a separate document or a series of documents. XML itself does not have a common DTD, and industries or organizations that want to use XML for data exchange can define their own DTDs.
----------------------

How do I read XML in a browser?

----------------------
The tools for reading XML documents are commonly referred to as XML parsers, also known as XML processors. The XML processor transmits data to the application software for processing, publishing, querying, or displaying. XML does not provide application interfaces (APIs) to applications, it simply passes data to the application software. XML processors do not parse data that is not well constructed. Both Netscape and Microsoft have included XML parsers in their browsers. The XML Developer community provides free XML readers and parsers to be used in application software or XML production software.
----------------------

Usage issues
How do I get an XML browser?

----------------------

The XML standard has been released shortly after the specification is introduced, so many are now in the pilot phase of the software. There are many browsers that handle HTML. But there will be a lot of different domains of XML applications in the future, so don't expect a browser to handle all the programs 100%.

XML tools (such as interpreters (parsing), tree management, search (searching), formatting tools (formatting), etc.) are added to the browser's library (libraries) or the Toolkit (toolkit ) helps developers to write XML programs more easily. This application can be modified by adding the appropriate semantics to suit another particular domain, or using languages such as Java to develop plugins embedded programs for browsers to transfer a module on the web.

Microsoft's IE4 and 5 browsers can handle some microsoft-oriented XML programs, but are converted to HTML files when they are displayed. For more information, see Development work at Microsoft and how to enable it. Arbortext's XML Stylesheet Program page describes how to use xml+xsl. You also need ActiveX controls and XSL codebase. Microsoft recommends that you add an XML segment to an HTML file, because now HTML-only browsers will ignore identity elements that are not recognized.

A downloadable Netscape (Mozilla) browser has passed a XML+RDF test using James Clark's Expatxml Interpreter (parser).

See the Software section for program designers and software and tool developers (notes), and more detailed information on http://www.oasis-pen.org/cover/xml.html.


----------------------

Why use XML rather than HTML?

----------------------

The more important reasons are the following six:

1 authors and vendors can use XML to design their own document types without being constrained by HTML.

2 because XML has a much greater ability to hypertext link than HTML, XML provides richer information content than HTML and is easier to use.

3 XML provides more and better mechanisms to facilitate browser information performance and optimize performance.

4 XML discards the complexity of SGML, so it's easy to write an application that processes XML.

5 information is easy to store and can be reused.

6 XML files are also available in SGML environments and are not necessarily limited to use in the Web.


----------------------

Must I turn to XML from SGML or HTML?

----------------------
Not necessary. Existing SGML and HTML application software will continue to work with existing files. But if you want to view or download the use of XML files, you need to use a program that understands and processes XML.
----------------------

Can I create and manage XML files in Java?

----------------------
Yes, any programming language can be used to output data from a source document in XML form. Many front-end and back-end tools have emerged that make programming and data management more convenient. The following two URLs are described in more detail: http://developerlife.com >http://www.markwatson.com/xmldb_0_1.htm http://developerlife.com
----------------------

Development issues
Where is the specification for XML?

----------------------

You can find it from the http://www.w3.org/TR/REC-xml.


----------------------

What are the meanings of terms such as "dtdless", "valid" and "well-formed"?

----------------------
In a standard SGML document, all the markup, element, and element attributes that are used must be described by a file type definition (DTD). But this restriction is not always needed in XML applications, so XML documents are designed to be either DTD-free or DTD-capable. Dtdless means that there is no DTD XML file, you can create your own identity and elements, but do not have to be formally defined in the DTD. dtdless files are defined directly by creating elements. However, when an XML application, such as a browser, encounters a dtdless file, a rule is still required to create a dtdless document because no DTD file tells the browser about the structure of the file. So the concept of "well_formed" XML document is produced, it clearly stipulates the syntax specification of writing XML document. All XML documents that conform to this specification are referred to as "well_formed" XML documents. If a "well_formed" XML document contains a DTD description, the document is called a "valid" XML document.
----------------------

Why is the parsing result of XML file garbled?

----------------------

This is caused by a coding problem. The XML standard stipulates that the XML parser must support "UTF-8" and "UTF-16" encodings, and must be able to distinguish between the two encoded files automatically, and does not require support for other encodings (including the commonly used Chinese encoding "GB2312" or "BIG5"). If an XML file contains an encoding declaration, the parser processes it according to the declared encoding, otherwise it is processed according to the recognition result (the result is always one of "UTF-8" and "UTF-16"). Therefore, if the XML file is encoded in both of these, you must precede the XML file with the encoding declaration, such as: <?xml version= "1.0" encoding= "gb2312"?> to indicate that the encoding of the XML file is "gb2312".

Most of the existing XML parsers do not support Chinese-encoded "GB2312" or "BIG5", so XML files containing Chinese cannot be read. You can use a parser that supports Chinese encoding, such as MSXML,IBMJAVA4C,IBMJAVA4J, for XML analysis. You can also use the Internal Code conversion tool, convert the encoding to "UTF-8" or "UTF-16" to parse, and then convert the parse result 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 code conversion program.

For more information on "UTF-8" and "UTF-16" encodings, see the UTF-16 and UTF-8 standards in the standard highlights of this site.


----------------------

How does XML connect to the database?

----------------------

XML is a file format, it does not specify the way to connect with the database, you need to use the traditional method to connect the database, database query, and then the query results into XML format. There are a number of tools that are now available to connect XML to the database, and most follow this step. The following is an example of using ASP to generate XML files directly, and you can access http://www.xml.net.cn/Asps/test/roster1.asp to view the execution effect.

Copy Code code as follows:
<%@ language= "VBScript"%>
<?xml version= "1.0" encoding= "gb2312"?>
<?xml:stylesheet type= "text/xsl" href= ". /image/roster.xsl "?>
<roster>
<%
Set cconn = Server.CreateObject ("ADODB. Connection ")
Call Cconn.open ("DSN", "USER", "PWD")
Set rs = Cconn.execute ("Select DISTINCT * from Roster")
Do but not Rs. EOF%>
<Record>
<name><%=trim (RS ("Name"))%></name>
<nativeplace><%=trim (RS ("Nativeplace"))%></nativeplace>
<age><%=trim (RS ("age"))%></age>
<telephone><%=trim (RS ("telephone"))%></telephone>
</Record>
<% Rs. MoveNext
Loop
Rs. Close
Set rs=nothing
Set cconn=nothing
%>
</roster>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.