Upload
hop-huynh
View
219
Download
0
Embed Size (px)
Citation preview
8/3/2019 08 - XML - SAX
1/36
XML: Nn tng, k thut v
ng dng
XML SAX
(Simple API for XML)
8/3/2019 08 - XML - SAX
2/36
2
8/3/2019 08 - XML - SAX
3/36
3
8/3/2019 08 - XML - SAX
4/36
4
8/3/2019 08 - XML - SAX
5/36
5
8/3/2019 08 - XML - SAX
6/36
6
8/3/2019 08 - XML - SAX
7/36
7
8/3/2019 08 - XML - SAX
8/36
8
8/3/2019 08 - XML - SAX
9/36
9
8/3/2019 08 - XML - SAX
10/36
10
8/3/2019 08 - XML - SAX
11/36
11
8/3/2019 08 - XML - SAX
12/36
12
8/3/2019 08 - XML - SAX
13/36
13
8/3/2019 08 - XML - SAX
14/36
14
8/3/2019 08 - XML - SAX
15/36
15
8/3/2019 08 - XML - SAX
16/36
16
8/3/2019 08 - XML - SAX
17/36
17
8/3/2019 08 - XML - SAX
18/36
18
8/3/2019 08 - XML - SAX
19/36
19
8/3/2019 08 - XML - SAX
20/36
20
DBI:
The Course I Wish I never Took
My favorite book!
8/3/2019 08 - XML - SAX
21/36
21
DBI:
The Course I Wish I never Took
My favorite book!
namespaceURI =
urn:http://www.w3.org/1999/xhtmllocalName = em
qName = xhtml:em
namespaceURI = ""
localName = book
qName = book
8/3/2019 08 - XML - SAX
22/36
22
8/3/2019 08 - XML - SAX
23/36
23
8/3/2019 08 - XML - SAX
24/36
24
8/3/2019 08 - XML - SAX
25/36
25
8/3/2019 08 - XML - SAX
26/36
26
8/3/2019 08 - XML - SAX
27/36
27
8/3/2019 08 - XML - SAX
28/36
28
8/3/2019 08 - XML - SAX
29/36
29
XML Lectures Notes Simple API for XML
8/3/2019 08 - XML - SAX
30/36
30
XML Lectures Notes Simple API for XML
8/3/2019 08 - XML - SAX
31/36
31
8/3/2019 08 - XML - SAX
32/36
32
8/3/2019 08 - XML - SAX
33/36
33
e s o 0 ate a ectu es otes sect o d 08 S p e o sect o ate a
public void warning(SAXParseException err)throws SAXException {
System.out.println(Warning in line + err.getLineNumber() +
and column + err.getColumnNumber());}
public void error(SAXParseException err)
throws SAXException {
System.out.println(Oy vaavoi, an error!);
}
public void fatalError(SAXParseException err)
throws SAXException {
System.out.println(OY VAAVOI, a fatal error!);
}
Extending the InfoWithSax Program
Will these
methods be
called in the
case of a
problem?
8/3/2019 08 - XML - SAX
34/36
34
p
Lexical Events
Lexical events have to do with the way that a document was writtenand not with its content
Examples:
A comment is a lexical event () The use of an entity is a lexical event (>)
These can be dealt with by implementing the LexicalHandler interface,and set on a parser by
reader.setProperty("http://xml.org/sax/properties/ lexical-handler", mylexicalhandler);
8/3/2019 08 - XML - SAX
35/36
35
LexicalHandler
// Methods (partial list)public void startEntity(String name);
public void endEntity(String name);
public void comment(char[] ch, int start,
int length);
public void startCDATA();
public void endCDATA();
8/3/2019 08 - XML - SAX
36/36
36
Info
Course name:
Special Selected Topic in
Information System
Section: Simple API for XML
Number of slides: 36
Updated date: 12/02/2006
Contact: Mr.Phan Vo Minh Thang