Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
ví dụ rộng lớn mà các nhà phát triển có thể đưa vào sử dụng ngay lập tức để xây dựng các ứng dụng tùy chỉnh XML. CD-ROM đi kèm chứa 3,1 JDeveloper, một môi trường phát triển tích hợp cho các nhà phát triển Java. | boss got the clever idea that it just might be useful to our customers as well. Once we heard that the information on Sun s site was available in XML we started smiling again. 3.3 Acquiring Web-based XML Content We check out the ServletsFAQ.xml file on Sun s site which they update periodically and notice that it has a format like this xml version 1.0 encoding UTF-8 Servlets-FAQ FAQ Q What s the next major release of the Servlet API Q A Servlet API 2.2 A FAQ FAQ Q How do I set the age of a cookie Q A yourCookie.setAge 120 A FAQ FAQ Q How do I save a variable in a per-user session Q A request.getSession true .putValue varname value A FAQ Servlets-FAQ We want this Servlet FAQ content and others like it from Sun s site to reside in our database so we can search over it together with all of our own content. We learn that the Oracle XML SQL Utility can insert XML documents automatically into our faq_table if they have the canonical ROWSET ROW structure so we create another XSLT stylesheet to transform a document in Sun s Servlets-FAQ vocabulary into a ROWSET ROW document ROWSET xsl version 1.0 xmlns xsl http www.w3.org 1999 XSL Transform xsl for-each select Servlets-FAQ FAQ ROW CATEGORY SERVLETS CATEGORY QLEVEL 1 QLEVEL QUESTION xsl value-of select Q QUESTION ANSWER xsl value-of select A ANSWER SUBMITTED_BY Sun SUBMITTED_BY ROW xsl for-each ROWSET This time the tables are turned and our XPath expressions in xsl for-each are looping over Sun s XML format and constructing the ROWSET ROW and column-name elements required for the automatic insert. As in all of our other stylesheets we use xsl value-of to plug in the Q and A children element values from the current Serviets-FAQ FAQ element as the values of our QUESTION and ANSWER elements. Note that because Sun doesn t keep track of the difficulty level in the FAQ format we re using a constant value of 1 in our stylesheet to default to a value that makes sense to our system. Also we use a constant value of SERVLETS for the .