Módulo II XML Processing: XSLT, SAX e...

Post on 19-Mar-2020

4 views 0 download

Transcript of Módulo II XML Processing: XSLT, SAX e...

1

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1

Módulo II XML Processing: XSLT, SAX e DOM

Prof. Ismael H F Santos

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 2

Ementa

Modulo II – XML ProcessingXML Processing - XSLT

2

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 3

Linguagem de Programação JAVAIsmael H. F. Santos, Apostila UniverCidade, 2002

Bibliografia

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 4

LivrosCore Java 2, Cay S. Horstmann, Gary Cornell

Volume 1 (Fundamentos)Volume 2 (Características Avançadas)

Java: Como Programar, Deitel & DeitelThinking in Patterns with JAVA, Bruce Eckel

Gratuito. http://www.mindview.net/Books/TIJ/

3

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 5

XML Processing

SOA

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 6

Onde usar XML?

4

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 7

Visualização em um browserFolha de estilo: conjunto de regras para formatar ou transformar as informações de um documento XML

CSS - Cascading Style SheetsTransformação visando apresentação visualAplicação do estilo em tempo de execução no cliente

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 8

Visualização em um browserXSLT - eXtensible Stylesheet Language

Transformação em texto, HTML ou outro formatoAplicação em tempo real ou prévia (no servidor)

Se não estiver associado a uma folha de estilo, o documento XML não tem uma "aparência" definida

Internet Explorer e outros mostram a árvore-fonte XMLNetscape mostra apenas os nós de texto

5

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 9

XLink

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 10

Exemplos de XLink

6

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 11

XPointer

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 12

Como produzir XML

7

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 13

Como manipular XML?Há duas APIs padrão para manipular (interpretar, gerar, extrair dados e tratar eventos) arquivos XML:

W3C Document Object Model (W3C DOM)Simple API for XML (SAX)

Servem a finalidades diferentesImplementações disponíveis em várias linguagensSAX oferece métodos que respondem a eventosproduzidos durante a leitura do documento

notifica quando um elemento abre, quando fecha, etc.DOM monta uma árvore, que permite a navegação na estrutura do documento

propriedades dos objetos podem ser manipuladas

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 14

Leitura de XML com SAX

8

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 15

Criação de documentos com DOM (1)

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 16

Criação de documentos com DOM (2)

9

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 17

XPath

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 18

XSLT

10

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 19

XSLT: documento-fonte (1)

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 20

XSLT: folha de estilos (2)

11

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 21

XSLT: documento-resultado (3)

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 22

XLink, XPointer e XQuery

12

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 23

XSL-FO

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 24

XSL-FO: menor documento

13

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 25

XHTML

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 26

SVG

14

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 27

Exemplo SVG

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 28

Algumas outras linguagens XML

15

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 29

Ferramentas XML

April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 30

Conclusões