Several ways to produce XML documents dynamically

Source: Internet
Author: User
Tags connect sql query version trim xsl access
xml| dynamic in today's world, the rapid development of technology, no matter what industry, most of the key data are placed in the database management, one of the current database technology has been quite mature, and the management function is very powerful. In the past, the data base structure of the database is relatively fixed, that is to say, the application developed is aimed at the specific data structure, its application category is restricted and the openness is poor.

XML as an Extensible Markup language, its self-describing makes it very suitable for data exchange between different applications, and this exchange is not defined as a predetermined set of data structure as a prerequisite, so it has a strong openness, has a broad application prospects. In order to make xml-based business data exchange possible, it is necessary to implement XML data access for the database and integrate XML data with the application so that it can be combined with existing business rules. The development of XML based dynamic applications, such as dynamic information publishing, Dynamic Data exchange, is to be able to extract data from the database, and dynamically produce XML documents. The current dynamic generation of XML documents is mainly in the following ways:

Directly generated by the database in this regard, Oracleand Microsoft Walk in front of other vendors. OracleAs the world's largest database and database application solutions provider, as early as 1999, the first to launch the support of XML database products Oracle8i. Microsoft announced in January 2000 that its next version of SQL Server (code-named Shiloh) would be a fully XML-enabled product that allows users to enter a URL address in a Web browser to access the SQL Server database. And the result returned can be an XML document. In addition, it allows you to specify style information by entering the style parameters to output rich pages in the browser. A typical URL looks like this: href = http://Localhost/northwind? sql = select + Firstname,lastname + from + employees + for + XML + Auto.

Generated by web middleware when a Web server receives a request, the middleware queries the database, and then converts the query results to 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 documents directly.

<%@ language= "VBScript"%>





Connect the database ———— below ————

<%

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%>

XML is generated ———— below ————



<%=trim (RS ("Name"))%>

<%=trim (RS ("Nativeplace"))%>

<%=trim (RS ("age"))%>

<%=trim (RS ("telephone"))%>



<% Rs. MoveNext

Loop

Rs. Close

Set rs=nothing

Set cconn=nothing

%>



This approach has been in the Monopoly forum ( http://www.delphibbs.comhas been applied, the tycoon forum also produced an offline browser, the essence of which is to use the ASP query returned XML data documents in the application processing.

Generated by other applications just as XML self-describing makes it very suitable for data exchange between different applications, exchanging data between systems based on XML data exchange is a process of generating, transmitting, and processing XML documents, so many programming tools have released new versions of supporting XML, in Delphi A series of controls that support XML data exchange have been introduced in 6, and the development of data exchange applications is no longer something that was previously elusive, thanks to the advent of XML.

As a whole, XML defines the structure by which data is passed between applications, and the description of the structure is not based on binary, code that can only be interpreted by the program, but rather as a simple text that can be read by any editor. Using this mechanism, programmers can develop the specification of the underlying data exchange, then develop the whole system's modules on this basis, and the data transmitted between the modules will be the standard data that conforms to the established rules. In addition, XML allows special data formats for specific applications and is ideal for transferring structured data between servers and servers. In short, in the near future, XML will become a bright star in the Internet.

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.