Thứ Năm, 31 tháng 7, 2014

Use Trax to tranform xml document

Demo : Create an application, which accepts an XSLT file as its first argument and XML document as second argument. Then, create an application using the following classes, which transforms a Source and sends the output to a Result object. 
1. Use the TransformerFactory class and its methods. 
2. Use the Transformer class and its methods.

Bước 1: Tạo new project



Bước 2: Tạo file employees.xml



Bước 3: Tạo file employeesStyle.xml
code CSS:



code sắp xếp dữ liệu theo username



code lấy dữ liệu



Bước 4: Viết code cho file main


Kết quả




Demo: https://drive.google.com/file/d/0B-EFzewQLSMDLV9KQjFkWjNXM2c/edit?usp=sharing

Nhận xét
-Việc chuyển đổi XML thành các định dạng khác là rất cần thiết và quan trọng hiện nay
-Nó được coi là một trong những đặc tính cơ bản của file XML.
-Việc chuyển đổi cũng khá dễ dàng và nhẹ nhàng
-Việc chuyển đổi sẽ rất có ích khi bạn muốn gửi dữ liệu cho ai đó

Không có nhận xét nào:

Đăng nhận xét