Author: Unknown
Directory 1.0 Introduction 2.0 XML is a database? 3.0 Why use Database? 4.0 Data and File 4.1 Data-centric Document 4.2 Taking Document Centered Document 4.3 Data, Document and Database 5.0 Data Acquisition 5.1 Map Document Schema to Database SCHEMA 5.1.1 Based on Form Based on Form 5.1 .2 Relationship - Object Mapping 5.2 Query Language 5.2.1 Template-based query language 5.2.2 SQL-based query language 5.2.3 XML Query Language 5.3 In the native XML database stores data 5.4 data type, NULL value, character set, and Other 5.4.1 Data Type 5.4.2 Binary Data 5.4.3 NULL Data 5.4.4 Character Set 5.4.5 Processing Instructions and Note 5.4 Tag Storage 5.5 Relationship [Database] Schema Generates DTD and the Converse 6.0 file 6.1 Storage file 6.2 In Blob 6.3 Native XML Database 6.3.1 What is a native XML database? 6.3.2 Native XML database architecture 6.3.2.1 Based on text-based native XML database 6.3.2.2 Based on model-based native XML Database 6.3.3 Native XML Database Features 6.3.3.1 File Set 6.3.3.2 Query Language 6.3.3.3 Update and Delete 6.3.3.3.3.3.5 Application Interface (APIS) 6.3.3.6 Double Channel Tickets 6.3.3.7 External Data 6.3.3.8 Index 6.3.3.9 External entity Storage 6.3.4 Standardization, reference integrity and scalability 6.3.4.1 Standardization 6.3.4.2 Reference Integrity 6.3.4.3 Scalability 6.3 Sustainable DOM (PDOM 6.4 Content Management System 7.0 XML Database Products 8.0 Related Links 9.0 Opinions and Feedback 1.0 Introduction This article describes how to use XML and databases, describe the data as The difference in the center and documentation in the documentation affects the general usage of the application, XML and relational databases in the database, and what is the native XML database and when it is used. 2.0 XML is a database? (IS XML A DATABASE?) Before you start discussing XML and database, we first answer the questions that many people mentioned: "Is XML is a database?" If you press only the nature of this term, the XML file is a database. That is, it is a collection of data. It doesn't seem to differ from many aspects that it is nothing differences - anyway, each file contains some type of data. As a "database" format, XML has some advantages: for example, it is self-description (the lack of the data describes the structure and type of the data, despite the lack of semantic), the portable (Unicode), can be treated Type or graphic structure describes data. Similarly, it also has a disadvantage, for example, it is redundant, since it is parsed and text conversion, the data accesses is slow. A more useful problem is whether XML and its peripheral techniques can be counted as "database" - ie database management system (DBMS). The answer is "sort of)".
From the front, XML provides a lot of data (XML documents), mode (DTD, XML Schema language), query language (XQuery, Xpath, XQL, XML-QL, Quilt, etc.), programming interface (SAX, DOM, JDOM), etc. From the reverse, it lacks some real databases should have: Efficient storage, indexing, security, transaction and data consistency, multi-user access, trigger, query in multiple files, etc. XML is suitable for use as a good example of the so-called "database" is .ini file - it contains configuration information for the application. With a parser that handles files with comma-delimited files, develop a small XML language and write a way to explain its SAX program. In addition, XML allows the use of nested entities, and comma-delimited files is difficult to do. However, it is said that it is still boring because it is linearly read and written, and is only used in the start and end of the program. Some complex datasets suitable for XML databases are personal address books (name, phone number, address, etc.), or to describe browser bookmarks and MP3 stolen with NAPSTER. However, because DBASE and Access are affordable, even if there is no reason if there is no reason to use the XML file as a database. The only real advantage of XML is the portable, because more and more tools can be used to access the database as XML, this benefit seems to have some discount. 3.0 Why use the database? (Why USE A DATABASE?) When you start considering the XML and the database, you must first answer this question: Why do you want to use the database first? Do you want to use existing data? Do you want to find a place to store web pages? Do you use a database in e-commerce, and XML acts as a data transmission carrier? The answer to these issues will greatly affect the choice of your database and middleware (if any) And how to use the database. For example, you have an e-commerce application to use XML as a data exchange. Then your data is preferably a height-regulated structure and is used by non-XML programs. Also, some things used by XML documents are not important to you, such as entities and codes. In short, you are interested in data instead of how it is stored in XML. In this case, you probably need a relational database and software that converts data between XML and databases. If your application is an object-oriented, you don't even need a system that allows these objects in the database or XML. On the other hand, if you want to create a website from some xml documents facing the prose-oriented. You must not only manage this website, but also provide a way to let users find content. Your document looks loose structure, the use of entities may be more important to you because they are an important part of the document structure. In this case, you may need a native XML database (Native XML Database) or Content Management System. This allows you to keep the physical structure of the document, support the file level transaction processing, and query using the XML Query language. 4.0 Data and Documents (Data Versus Documents) The most important factor when choosing a database is probably what you want to store data in the database or document.
For example, it is simply as a data conversion tool between the database and (may not support XML) applications, or is it used to integrate, just like XHTML and DOCBOOK? This is usually a preference, but it is very important because all of the same characteristics in data-centric documents, all of which have many Document-centrics. This will affect how XML is stored in the database. In the following two parts, we will visit these features. (Historical Background: I first heard of Data-Centric and Document-Centric on the XML-DEV mailing list, I don't know who is invented, but I found Document-Centric in 1997, from These two terms have been used in 1998.) 4.1 Data-centric documents (data-centric documents) Central document is data-centric documentation is the transmission carrier for data as data, which is specifically provided to machine consumption, there is no need All use XML. That is, for the application or database, the data is stored in the form of an XML document in a certain period of time. Examples of documents centered on data have sales orders, flight schedules, scientific research data and stock market exchange rates. The data-centric document is characterized by quite normal, fine-grained data (i.e., the smallest independent data unit exists only at the PCDATA element or attribute level), rarely or has no mixed content. Unless verified by the document, the order of the appearance of the same level or PCDATA is generally not important. Such data in data-centered documents can be from the database (to XML at this point) or outside the database (now you want to deposit it into the database). An example of the former is a large amount of data in the existing database; the research data from the measurement system is collected and converted to XML is an example of the latter. For example, the following sales order is based on data:
Customer>
Turkey Wrench: b>
Stainless Steel, One-Piece Construction,
Lifetime Guarance. P>
Description>
Part>
Item>
stuffing separator:
Aluminum, One-Year Guarantee. P>
Description>
Part>
Item>
SalesOrder> In addition to this obvious data-centric document, many item-based documents may be data-based except for the marketing order. For example, Amazon.com is used to display a page of book information. Although most of the content on the page is text, the structure of these text is very rule, many of them are the same as other books, and there are not many texts that are unique to each page. In this way, the relevant information of books can be taken from the database, converted to simple, data-centered XML documents, and then generate a page with the XSL style table. In general, those websites that use data in the database, dynamically generate HTML files can turn to use a series of data-centric XML documents and XSL style sheets. For example, the following is a document describing flight information:
Non-Stop Flights Daily from
And
Flightinfo> Create this document from the XML file below and a simple style sheet:
Flight>
Flight>
Flight>
Flights> 4.2 Document-centric documents (Document-Centric Documents) is usually for consumption. For example, books, email, advertising, and almost all artificial XHTML files. Its characteristics are structurally unsteady or irregular, and the data particle size (the minimum independent data unit may exist in the elements of the mixed content or even the entire document itself), and the mixed content is more. The order of the appearance of the same level or PCDATA is generally always very important. The documentation-centered documentation is usually written in XML or converted from other formats (such as RTF, PDF, SGML) to XML, which is often not derived from the database. (The document obtained by the data inserted into the template is data-centric; more information, see the end of the 4.1 section). Conversion of various formats into XML software information, see XML software related links. For example, the product below is based on documentation:
The
Fabrication Labs, Inc. Wevel> is
But not as big. summary>
Intro>
Handed Versions (Skyhook Optional) i>, IS Made of the Finest
Stainless Steel b>. The Readi-Grip Rubberized Handle Quickly Adapts
To Your Hands, Even in The Greasiest Situations. Adjustment IS
Possible Through a Variety of Custom Dials. Para>
List>
Order Now, Comes With a Hand-Crafted Shrimp Hammer b> as a
Bonus gift. para>
Description>
Product>
4.3 Data, documentation, and database (Data, Documents, And Databases) In fact, the difference between data-centered and document-centered documents is not necessarily obvious. For example, another document, such as an invoice, may contain large particle size, non-structured data such as part instructions; another document such as a document such as a user manual, may contain fine-grained structural rules. Data (usually metadata) such as the author and revision date. Other examples include legal and medical instruments, although written in the form of prose but contain discrete data blocks such as date, name, and operation procedures, for statutory reasons, it is usually stored in a complete file form. In addition, the two characteristics of clarifying documents help to select the type of database. In general, the data is stored in a conventional database, such as a relational, an object-oriented or hierarchical database. This can be completed by the third party's middleware or by the database itself provides intrinsic support. For the latter, the database is called XML-enabled. Documents can be stored in native XML databases (database designed for storage XML) or content management system (built in the native XML database specifically used to manage documents). These principles are not absolute. If the features that are unique to XML do not value, data, especially semi-structured data can be stored in the native XML database, and the document can also be stored in the traditional database. What is the boundary between traditional databases and native XML databases is getting more and more blurred, and the traditional database has increased the ability of native XML, and the native XML database adds support for document storage in the external (usual relational) database. The remaining parts of this article discussions with the strategic and reading of data (Section 5) and documentation (Section 6). For the latest XML database products, please see XML Database Products. 5.0 STORING AND RETRIEVING DATA In order to exchange data between XML files and databases, it is necessary to map Schema (DTD, XML Schema, RELAX NG, etc.) of the XML file to the database of Schema. Software for data conversion is built on this mapping. The software can use XML Query language (such as XPath, XQuery, or other dedicated language) or simply convert data in accordance with the mapping (Select * from Table XML peer). For the latter, the structure of the document must fully comply with the structure required by the mapping. Since it is usually not easy to do, products using this strategy are usually used with XSLT. Before the data is switched to the database, the file will be converted according to the structure required by the mapping, and then the data is transferred. Accordingly, after the data is removed from the database, the result file is converted to the structure required for the application. 5.1 Mapping [XML] Files Schema to Database Schema (Mapping Document Schemas To Database Schemas) File Schema to Database Schema's mapping is made on element type, attribute, and text. Almost always ignore physical structures (such as entities, CDATA) and certain logical structures (such as handling instructions, annotations, and sequential sequentials that appear in parent elements). This is more reasonable than it, because the database and application simply cares about the data in the XML file. For example, in the above-mentioned sales order, the customer code is in the CDATA portion, or the external entity is not important, and the customer code has nothing to do before or after the order date. One consequence of this method is whether the document has a "round-trip ticket" - after depositing the data in the file, the data from the data in the database, and this file is often different from the original file (even from the most In general, in general). Is the software to consider whether it is allowed to occur.
There are two ways to map the Schema of an XML file to the database. There are two ways: table-based mapping and object-relational mapping. 5.1.1 Table-based mapping Many intermediate software for converting XMLs to the database adopts a table-based mapping. It treats XML files as a (or a group) table, that is, the structure of the XML file must be the following look, if only a single table, no longer need the