 能夠利用 XPATH 與 Xalan 套件,撰寫 JAVA 程 式,進行 XML 文件的查詢功能.

Slides:



Advertisements
Similar presentations
XPathAPI XPathAPI HOME : API : j/apidocs/ Lib.
Advertisements

The Java Platform and XML Portable Code, Portable Data James Duncan Davidson Staff Engineer, Sun Microsystems, Inc.
Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 24. November 2009.
SE 5145 – eXtensible Markup Language (XML ) DOM (Document Object Model) (Part II – Java API) /Spring, Bahçeşehir University, Istanbul.
The Semantic Web. The Web Today Designed for Human to read Cannot express meaning Architecture: URL –Decentralized: Link structure Language: html.
Introduction to Java Programming Lecture 13 Classes I OO Programming.
第 10 章 Java 的執行緒 10-1 執行緒的基礎 10-2 Java 執行緒的使用方法 10-3 Java 執行緒的同步 10-4 管道串流的執行緒.
Object-Oriented Concepts. 1-2 Previous study How to link “Java SDK” library –Using path and Classpath What benefits of “java” –Compile to byte-code and.
Proxy Mobile IPv6 for NS2.29 TA: 洪敏書
What is static?. Static? 靜態 ? class Test { static int staticX; int instanceX; public Test(int var1, int var2) { this.staticX = var1; this.instanceX =
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
EBSCO 資料庫. 基本檢索畫面 問題: 想看哈佛商業評論 點選 [ 出版品 ] 輸入 [ 期刊名稱 ]
ACM DIGITAL LIBRARY Presentation by 郭珮琪 Penny Kuo
第 18 章 名稱空間與例外處理 18-1 名稱空間 18-1 名稱空間 18-2 例外處理 18-2 例外處理.
程式註解說明. 2 程式註解格式 塊狀註解 對檔案、 class 、 method 、資料結構、一段程式 …. 等程式區塊 做說明。 第一行的開頭必需為 “/*” 且沒有其他文字,最後一行的開頭 必需以 “*/” 做為結束,在中間每一行的開頭都必需是一個 “*” 。 單行註解 佔據一整行的說明。 以.
1 Introduction to Java Programming Lecture 4 Using JOptionPane Spring 2008.
長訊科技 EVRCOM Voice Mail System 使用者操作說明及流程. 自動總機 -- 來電語音轉接服務流程 ( 範例流程 )
Introduction to Java Programming Lecture 5: Using Java Classes : String & Math Spring 2009.
Chapter 13 塑模靜態觀點:物件圖 Static View : Object Diagram.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
智慧藏科技知識庫使 用說明 呂明欣 國立政治大學資訊科學系機器智能實驗室 語言教學研究中心 2006/12/5.
第九章 結構. 結構的宣告 結構 它是由許多不同 ( 或相同 ) 資料型態的變數所組成的 集合,通常利用結構標籤稱呼此集合 struct student { char *name; int score; }; struct 為保留字,表示結構的宣告開始 結構項目需定義於大括號「 { } 」內 結尾需加上分號.
第 1 章 認識資料庫系統 著作權所有 © 旗標出版股份有限公司.
Hung-Hsiang WuWindows Processing Design1 Chapter 7 其他基礎控制 ScrollBar 應用 MainMenu 應用 PopupMenu 應用 Timer 應用 Image 應用 BitBtn 及 SpeedButton 應用.
Xerces The Apache XML Project Yvonne Yao. Introduction Set of libraries that provides functionalities to parse XML documents Set of libraries that provides.
Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File.
第二章 供給與需求 中興大學會計學系 授課老師:簡立賢.
第12章 建立多表單與模組的應用程式 12-1 Visual Basic的方案與專案 12-2 模組化Visual Basic應用程式
Department of Air-conditioning and Refrigeration Engineering/ National Taipei University of Technology MATLAB 操作與 系統動態模擬 SIMULINK 李達生.
1 單元四 個人化服務 Web of Science 利用指引. 2 個人化服務 Sign In 登入 My EndNote Web 使用 EndNote Web 者可登入 My Citation Alert 查看或修改先前設定的引用通告 My Saved Searches 查看或更改先前儲存過的檢索.
第二屆數位華岡 e-Campus 網頁設計競賽 Inaugural Digital Hwa-Kang e-Campus Web Award, 2006 服務導向的網站規劃 Service-Oriented Web Site Design 楊美華 組長
North Point Government Primary PM School 北角官立下午小學 應用 ‘ 基本能力學生評估 ’ 及 ‘ 網上學與教支援系統 ’ 經驗分享.
In Chapter 1 您將學到什麼 ? 了解 Java 語言的特徵 Java 程式的發展過程關係 Java 程式的基本架構.
1-6 動畫的文件屬性 舞台是動畫實際播放的畫面, 所以舞台的大 小與長寬比例對將來動畫的呈現有很大的 影響。 Flash 預設的舞台尺寸是 550 Pixels × 400 Pixels, 背景為白色, 如果要更改舞台大小與 背景色, 請執行『修改 / 文件』命令, 開啟文 件屬性 (Document.
Chapter 17 Windows API 程式入門 VC++ 與 WindowsVC++ 與 Windows 建構遊戲設計的舞台 建構遊戲設計的舞台.
6-2 認識元件庫與內建元件庫 Flash 的元件庫分兩種, 一種是每個動畫專 屬的元件庫 (Library) ;另一種則是內建元 件庫 (Common Libraries), 兩者皆可透過 『視窗』功能表來開啟, 以下即為您說明。
Advance Window Programming 游子宜. MFC 類別函式庫 MFC(Microsoft Foundation Class Library) 是一套 整合在 VC++ 中供開發視窗程式用的類別函式庫, 提供了豐富的類別函式供程式設計師來開發各類 的視窗應用程式。
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
Management Abstracts Retrieval System; MARS 檢索操作.
Chapter 3 Entropy : An Additional Balance Equation
校園網頁整合平台介紹 電算中心綜合業務組. 大綱 設計理念 功能介紹 實做 FAQ 特殊案例 Q&A.
Structural Equation Modeling Chapter 6 CFA 根據每個因素有多重指標,以減少 測量誤差並可建立問卷的構念效度 驗證性因素分析.
第 17 章 樣板 17-1 樣板的基礎 17-1 樣板的基礎 17-2 樣板函數 17-2 樣板函數 17-3 樣板類別 17-3 樣板類別 17-4 非型態參數的樣板類別 17-4 非型態參數的樣板類別 17-5 樣板類別的繼承 17-5 樣板類別的繼承 17-6 特化樣板與靜態成員 17-6 特化樣板與靜態成員.
第12章 多重表單與模組的應用程式 12-1 VB.NET的方案與專案 12-2 模組化VB.NET應用程式 12-3 多重表單的應用程式
企業建置 ( 二 ) JSP 與 JDBC 井民全. 複習一下 JDBC 建立連線 Import java.sql.*;// for Connection, Statement … Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:book");
2015/6/27T.B. Chen1 Using PERL 1.PERL 的簡介 2.PERL 的資料型態 3.PERL 的運算子 4. 控制結構與陳述式 5. 副程式 6. 檔案 I/O 與參考指標 7. 常規表示式.
1 Introduction to Java Programming Lecture 4 Using JOptionPane Spring 2010.
第 17 章 泛型類別與.NET Framework 17-1.NET Framework 類別函式庫 17-1.NET Framework 類別函式庫 17-2 使用.NET FCL 的類別 17-2 使用.NET FCL 的類別 17-3 My 名稱空間的類別 17-3 My 名稱空間的類別 17-4.
2 期末程式第一份報告 報告內容 撰寫此程式的動機和目的以及預期達到的功能和結果 流程圖 繼承關係 資料結構 檔案上傳格式 第 n 組程式流程圖.doc 組別於近日內公告 5/31, 17:00 前交.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
Biological Science Database 個人化服務設定步驟. Biological Science Database 僅提供專題選 粹服務 專題選粹 (Alerts) :查詢後,提供儲存檢 索策略的功能,日後每週將符合條件的 更新資料,採 方式通知。每筆設定 最多每週可收到.
海洋大學力學聲響振動實驗室 1 ECCENTRIC PROBLEM OF LAPLACE EQUATION VIA BEM AND BIEM FINAL REPORT OF BOUNDARY ELEMENT METHOD Z. H. Kao.
函式 Function 東海大學物理系‧資訊教育 施奇廷. 函式簡介 當程式越來越大、越複雜時,程式的維護、 除錯會變得更困難,此時必須引入函式來 簡化程式或將程式分段,將程式重複的部 分改寫為函式,將程式「模組化」 這種作法有下列優點:節省程式發展的時 間、邏輯容易瞭解、程式容易除錯、可分 工合作完成程式.
Visual C++重點複習.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
OmniFile Full Text 系列資料庫 個人化服務設定步驟. 此相關資料庫之個人化服 務只提供類似專題選粹的 服務,然無提供 mail 通知的 服務,讀者可建立個人 ID , 並儲存檢索策略,日後需 再進入該資料庫,查詢檢 索策略之新進文章。 導航目次 個人化服務說明 個人帳號密碼申請 個人化服務設定.
What is static? CS340100, NTHU Yoshi. Static? 靜態 ? class Test { static int staticX; int instanceX; public Test(int var1, int var2) { this.staticX = var1;
遠端北風資料庫 公佈時間: 2006/4/26 繳交截止時間: 2006/5/10. 作業目的 實作遠端資料庫瀏覽程式.
1 化學品管理系統介紹 工研院資訊中心 何玲菁 內容  目的  作業流程  權責  系統登入  功能說明  系統展示  Q & A.
Introduction to XPath Transparency No. 1 Introduction to XPath API Cheng-Chia Chen.
Chapter 16 AJAX. Introduction AJAX stands for Asynchronous JavaScript And XML. AJAX is a type of programming made popular in 2005 by Google (with Google.
Java Tutorial /10/21. Java Resource Java SDK –Download from –Install Jdk windows-i586.exe –
Software Engineering for Digital Home 單元 3 :軟體設計 Chapter 3-6 – Specifying Interfaces.
1 JAXP & XPATH. Objectives 2  XPath  JAXP Processing of XPath  Workshops.
XML DOM.
1 類別與物件 II (Classes and Objects II) 鄭士康國立台灣大學 電機工程學系 / 電信工程研究所 / 資訊網路與多媒體研究所.
USING ANDROID WITH THE DOM. Slide 2 Lecture Summary DOM concepts SAX vs DOM parsers Parsing HTTP results The Android DOM implementation.
XML. Contents  Parsing an XML Document  Validating XML Documents.
WaysInJavaToParseXML
WaysInJavaToParseXML
Presentation transcript:

 能夠利用 XPATH 與 Xalan 套件,撰寫 JAVA 程 式,進行 XML 文件的查詢功能

import org.apache.xpath.XPathAPI; Import org.w3c.dom.traversal.*; //for NodeIterator public class ApplyXPath { public void xxx() { String xpath = ….; // Set up a DOM tree to query. Document doc ….. // Use the simple XPath API to select a nodeIterator. NodeIterator nl = XPathAPI.selectNodeIterator(doc, xpath); Node n; while ((n = nl.nextNode()) != null) { if (isTextNode(n)) { // DOM may have more than one node corresponding to a single XPath text node. // Coalesce all contiguous text nodes at this level StringBuffer sb = new StringBuffer( n.getNodeValue() ); for (Node nn = n.getNextSibling(); isTextNode(nn);nn = nn. getNextSibling ()) { sb.append(nn. getNodeValue ()); } System.out.print(sb); } ….. }

Sample4 1. Files: Sample4.java testdata.xml xalan.jar serilizer.jar 2. Compile javac -classpath xalan.jar;serilizer.jar Sample4.java 3. Run java -classpath.;xalan.jar;serilizer.jar Sample4 // 範例 操作說明

import org.apache.xpath.XPathAPI; Import org.w3c.dom.traversal.*; //for NodeIterator // 建立一個含有 namespace 的節點 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); Document namespaceHolder = impl.createDocument("", "namespaceMapping", null); Element namespaceND = namespaceHolder.getDocumentElement(); String q_name = “xmlns:mcu”; String ns = “ namespaceND.setAttributeNS(" q_name, ns); Node context_node = …. String xpath = …. NodeIterator nl =XPathAPI.selectNodeIterator(context_node, xpath, namespaceND ); 含有 namespace 宣告的元素 xmlns:mcu=“

Sample5 1. Files: Sample5.java testdata.xml xalan.jar serilizer.jar 2. Compile javac -classpath xalan.jar;serilizer.jar Sample5.java 3. Run java -classpath.;xalan.jar;serilizer.jar Sample5 //mcu: 範例 操作說明

 歸屬於 org.apache.xpath 套件  提供 6 個 XPATH 查詢功能 › Node selectSingleNode (Node contextNode, String str) › Node selectSingleNode (Node contextNode, String str, Node namespaceNode) › NodeIterator selectNodeIterator (Node contextNode, String str) › NodeIterator selectNodeIterator (Node contextNode, String str, Node namespaceNode) › NodeList selectNodeList (Node contextNode, String str) › NodeList selectNodeList (Node contextNode, String str, Node namespaceNode)

 介紹 XPathAPI 類別  XPathAPI 類別在 XPATH 查詢的應用