One, Xml technology brief introduction
XML (EXtensible Markup Language? ? Can expand sign language) it is the source sign language that expands one kind, it is the language that can define other language.
One it is SGML simplifies subclass, this subclass is designed for Web environment only, this that is to say, it must handle those who face data processing (is not to face those who release) , live period short (be dynamic generation actually) information.
XML and HTML are comparative:
XML grammar is strict, data and indication depart, facilitate other program is mixed interactively retrieve data.
Sex of HTML syntactic fault tolerance is big, data and show be together, retrieve data difficulty bigger.
The DOM object that XML makes clear again, can undertake reading writing buying the operation of cutout data to XML file.
HTML completes this operation without this kind of specific target.
XML overcame a variety of inadequacy of HTML, upload the network the documentation standardization that be defeated, gift the meaning with certain ticket.
XML exchanged a format to get quickly supportive as the current data in system of a kind of network, the actual profit of use XML has:
Structuralization? ? Build the number that has any complex arrangement to roll a model.
Can expansibility? ? Root Ju needs to define new label.
Test and verify? ? The validity that checks data to go up in the structure.
Independence and agency? ? Release content with a variety of means.
Mix at the supplier independently platform? ? The commercial software of use standard even text tool handles any according with (XML standard) documentation.
XML documentation can be passed can expand modal language XSL (Extensible Style Language XSL) changeover and format change XML documentation. Realize the depart of data and page style thereby.
2, realize XML with JSP technology
JSP was offerred a series of characteristic, can work very ideally in coordination with XML, JSP webpage can include the text data of any types, so JSP can generate the documentation that contains XML directly. And, JSP can use powerful JAVA platform to come information of XML of analytic, changeover and documentation. Because JSP also is the one part of JAVA software environment, JSP also can use API object to process XML data. The powerful function of JSP technology and very good flexibility add the data of XML technology standardization, the OK and perfect trends that realizes a webpage displays a function.
3, develop an environment
1, editor tool
Now, the tool that develops XML documentation more and more come much, develop an environment from the company level XML that links large company database, to simplify the simple small-sized text editor of mark development process. Newest tool can understand from Http://www.xml.com. Current, tool of commonly used a few kinds of development introduces as follows:
UltraEdit is developed by company of IDM Computer Solution, can to free download of Http://www.ibmcomp.com or Http://www.ultraedit.com deadline is used edition. It is the resource management that the interface is similar to Windows implement the interface of type, very strong text makes up arrest function.
The XML Spy of company of XML Spy Icon Information-Systems is XML environment of a compositive development, include to have each sides of XML development, the function is stronger, use easily simply. XML Spy is a truly whole XML development environment. The element that it wants place of all development XML includes the product that uses easily simply in in. It includes: XML editor and examine, Schema/DTD editor and examine, XSL editor and changeover. Still include newest XML draft at the same time, it is the good software of a rare.
XML Writer this software is developed by Wattle Software-Chris Howard, can download from Http://XMLwriter.net (try out) . Use below Window 95/98/2000 And Windows NT4, also having everybody’s familiar Windows interface, provided project management environment, dig builds the likelihood, examine a project, the file is included below the project, the user can define toolbar, shortcut key oneself, and can be order option show icon. Watch of usable XSL style changes XML file to be HTML file, can use XSL not only, and can use XQL, undertake examining to XML with DTD or XML Schema, with XML format direct combine CSS XML, provide online help function, and it is opposite the support of Chinese is better.
2, XML server
Because XML technology has very large development latent capacity, numerous manufacturer offerred his XML server, among them Apache, Microsoft, Sun waits.
3, the tool of the XML that browse
Now, most plan is XML memory is in the database, take out code when need, rise its and data union, use XSL is its changeover HTML, send a browser next. So the XML that browse chooses IE commonly but Netscape, and version has been jumped over newlier to XML documentation support.
4, specific implementation
1, the masurium in documentation of normative definition XML says
Define XML documentation head above all, means of the standard that includes XML to abide by, encode, annotate. For example:
<? Xml Version=”1.0”Encoding=”gb2312”Standalone=”yes” ? >
“version=”1.0”“ , state this XML documentation follows XML1.0 plan, this comedic statement is must.
“encoding=”gb2312”” , if do not have this statement, must use Unicode, regard number as means with UTF-8 or UTF-16. If Chinese was used in the file, must undertake coding stating.
“standalone=”yes”” , XML statement still can have Standalone character, it explains, whether does documentation need to guide from office department in this one file file. If XML documentation is finished in a file, so the value of Standalone character is “yes” with respect to the setting.
Next, according to the need of business the standard defines the element that should show on the page, and the masurium that defines them says, elemental name can be Chinese, describe more simple palpability to data so, HTML cannot realize this. The element is the main logic unit of documentation, by begin and end mark to limit, the format is:
<1=“ attribute is worth name of elemental name attribute 1”2=“ attribute is worth attribute name 2”>
Elemental content
</ masurium says>
Elemental content, can write on the page directly, also can obtain from inside the database.
Hypostatic statement and substance still can include to cite in documentation. Say simply, hypostatic cent is general substance and parameter substance. Parameter substance can appear in DTD only, general substance goes out to begin in an element now advocate in XML documentation. Entity states the format is: . The adduction of general substance is very simple: “& hypostatic name; ” , the adduction of parameter substance and general and hypostatic adduction are similar: “% hypostatic name; ” . Entity is the tool with powerful function, offerred those who manage a large number of content is convenient mechanism.
XML documentation is checked after been write, ensure the pattern of documentation is mixed correctly effective. The XML documentation with a proper form is contented:
Each element must have initiative tag with the end;
Must have, and the element that only one calls an element or file element, and it does not appear in other in the content of any elements;
It contains one or more element
Define and represent empty element correctly;
With the end mark can use capitalization or small letter, but they must match;
Each elements that are a bound with initial tag and end label must correctly nest, do not allow occurrence across;
Property value must use quote draw together to rise;
Direct or the each oneself analyse of indirect referencing is solid in this file resting is the form is proper;
All and other format validity that it defines in contented XML standard are restrained.
2, use XSL shows XML documentation
XSL (EXtensible Stylesheet Language) a kind of language that is style of descriptive XML documentation, make by W3C. XSL processing program is read take XML documentation and XSL style sheet, be based on processing program to dictate in what find in XSL style sheet, output new XML documentation. XSL style is expressed even if be opposite in XML documentation kind descriptive file, describing what the file explains is how to use a format to change lexical general kind example changeover is documentation of a XML. In the meantime, XSL style watch also must be the XML with good organization.
XSL has the module of 3 composition: XSL mode (XSL Patern) , ”XSL” name region (”XSL”Namespace) , ”fo” name region (”fo”Namespace) . Sheet of use XSL style can have 3 kinds of main way to change XML documentation into other form: XML documentation and relevant modal sheet are to be used at the client to carry (Web browser) , next the client carries a program to decide a format to change documentation according to modal simple middle finger, present it the user; The server uses XSL style sheet at XML documentation, so that this documentation can be changed into other some kind of format (it is HTML normally) , send the documentation after changeover to the client to carry a program (Web browser) ; Use tripartite program to change source XML documentation into other some kind of format (it is HTML normally) , just place this documentation on the server, server and client program handle the documentation after changeover only. As a result of, most browser is IE, and the IE support to XSL good, the first kind of method often is used.
XSL changeover language alternates through establishing XML shape structure another XML cultivates shape structure to operate. This kind of language contains operator, this operator is used choose new to node sort and specific node, output node from inside establishing shape structure. Be as follows in the specification that XSL cites in XML documentation:
<? Xsl-stylesheet Type=”text/xsl”Href=”mystyle.xsl” ? >
The XSL style sheet that shows this XML documentation cites is Mystyle.xsl. Content and formal depart make XML documentation more slant overweight data itself, and the influence of the minor details that does not get indication way. And the modal sheet that can differ through the definition can use same data to present a different indication outward appearance, realize XML data but sex of put sb in a very important position.
Define the module that tectonic part outputs above all, or to coming from XML source file medium data uses pattern plate. Changeover pattern plate is included in elemental Xsl:tIn Emplate, pattern plate can define a group to change source documentation the regulation that upholds for the result, want the node of processing certainly. Match pattern next, a mode is a string, it matchs an element in XML source file with Yu Pi. Match attribute node with @ . The element in reoccupy XSL changes the element in XML documentation. It is very OK to use XSL realize the same definition expressing sheet in be the same as HTML conveniently. Want to will be in the XSL pattern plate with express the element in sheet to put a definition good only can, the name that expresses sheet, carry justice the definition in attribute and the HTML such as means is same. The limits of same table, style, the indication style of the page, script the definition that wait is as similar as HTML also.
Additional, CSS also can apply XML documentation, but the visual exterior that CSS decided a page, won’t change the structure of source documentation. CSS and XSL are mutual complement, each distinctive.
Sheet of watch of documentation of the XML after be being changed through XSL submits JSP page or Servlet undertakes handling. This part can handle departure completely with the page, can realize the complete independence that controls logic.
3, the output of XML documentation data
The main application of XML includes to exchange information of type of documentation of information, definition, specification, information is conveyed with the is based on text format means of a kind of structuralization, can undertake easily transmission, changeover and illuminate. The processing that logarithm occupies can be put in Javabean or Servlet to undertake entirely, the indication with the page is completely apart.
XML documentation is generated in JSP very simple, still can use CSS or XSL to change and show XML. One has the JSP page of XML pattern plate, pledge actually even if be in XML documentation pattern plate, JAVA code and JSP number are joined in proper place. Join in the page<%@page ContentType=”text/xml”% > can with JSP page, with XML documentation form explicit come out, put dynamic data at the same time<Inside mark of % % > . The XML that opposite becomes can use XSL style sheet to undertake format changeover and modal definition wait likewise.
4, XML and JAVA are united in wedlock
XML can found the open data that does not rely on platform, language or restricted format to spend a deal, if be used widely, XML can become for content and the extensive standard that issue to carry an object to connect fast to the client. JAVA increased in a lot of respects as content platform XML. XML turns the information place bid that is based on a network, make developer and computer identify easily. This is those who be necessary because of HTML besides hidden URL, lack effective method to show the meaning of content, the target of XML adds those meanings with respect to the object that is a network, and one of these tasks that once were JAVA.
A lot of network developer conclude: XML and JAVA are a perfect pair, because of each other complementary photograph becomes ten split phase, XML conduces to the documentation that collects information independent platform, easily and data. JAVA conduces to independent platform, the object-oriented application software solution that handles easily, can the application that drive XML accepts extensively is those application that come true hard below the limitation of HTML, can divide for following 4 kinds:
Need network client carries the application that coordinates all sorts of different type databases.
Strive works the processing with considerable scale to carry the application that distributings to be carried at the client from the server.
The application of the person that requirement client end develops same data different use with different form.
The requirement of individual user searchs intelligent network acting behoove the application of custom-built information.
JAVA platform provided the in the safety on the network basis that transmits code conveniently, XML technology provided same capability for data, this is a kind of clear ground, platform the method that independent the earth’s surface shows content. In numerous programming language, JAVA is the outstanding platform of use XML, XML is the method of outstanding data presentation of JAVA application. XML and JAVA are as close as Internet relation, XML is designed those who optimize to become, agile readable format, can use at Internet directly; And JAVA from support Socket at the beginning, HTTP, HTML and server. They support Unicode. Consequently this locality of very easy implementation turns application, JAVA of no less than provided the capability that conveys complex data structure and object-oriented model to programmer same, using XML to convey complex arrangement to turn data model is very ideal.
XML combines JSP technology structure to understand easily clear analyse of clear, consecution, simply, it is a when develop dynamic website fast and convenient development way.
Bookmark:Digg Del.icio.us Reddit
