?9? JSP??XML?? - PowerPoint PPT Presentation

Loading...

PPT – ?9? JSP??XML?? PowerPoint presentation | free to download - id: 4bdf26-Zjk1N



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

?9? JSP??XML??

Description:

9 JSP XML eXtensible Markup Language XML – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 50
Provided by: readPudnC
Category:
Tags: jsp | xml | font | size | unicode

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: ?9? JSP??XML??


1
?9? JSP??XML??
9
2
????
  • ???????(eXtensible Markup Language,XML)???????????
    ?????
  • ??????XML????, XML???????CSS(Cascading Style
    Sheet,???????)?XSL(Extensible Style
    Language,???????)?Data Island(???)
  • ????JSP??XML???

3
XML???
  • XML?????????,????????,???????XML?????????HTML,HTML
    ?????????,??XML,??????????????
  • XML(eXtensible Markup Language)?HTML(Hyper Text
    Markup Language)????,???SGML(Standard Generalized
    Markup Language)?????????

4
XML?????
  • ?????????
  • ????9-01.xml
  • lt?xml version"1.0" encoding"gb2312"?gt
  • lt??gt
  • lt??gtzhourunfalt/??gt
  • lt??gtmalelt/??gt
  • lt??gtTeacher Peking Univ.lt/??gt
  • lt/??gt

5
??????
?????????? ????9-02.xml lt?xml version"1.0"
encoding"gb2312"?gt lt????gt lt??gt???lt/??gt lt??gt????
lt/??gt lt??gt??????lt/??gt lt??gt2000lt/??gt lt/????gt
6
????
???????? ????9-03.xml lt?xml version"1.0"
encoding"gb2312"?gt lt????gt lt??
??"??"gt???lt/??gt lt??gt????lt/??gt lt??gt??????lt/??gt
lt?? ??"??"gt2000lt/??gt lt/????gt
7
???XML????
???????XML???? ????9-04.xml lt?xml
version"1.0" encoding"gb2312"
standalone"yes"?gt lt????gt lt??gt???lt/??gt lt??gt??lt/?
?gt lt??gt lt??gtNonelt/??gt lt/??gt lt??gt
?????lt/??gt lt!--????--gt lt????gtshizhiguo_at_163.netlt/
????gt lt/????gt
8
XML??
  • XML????lt?xml???,??9-04.xml????
  • lt?xml version"1.0" encoding"gb2312"
    standalone"yes"?gt
  • XML???????????????????XML?????XML????????XML??????
    ?
  • ?????????XML???XML????????,?????,?XML???????????
    ???XML???????version,encoding?standalone?????

9
???????
  • ??????????XML?????????,???????????????????????????
    ????
  • (1)????????????,????????????
  • (2)?????????,?????????????
  • (3)??????????,??????????????
  • (4)????????????????????

10
XML???????
? ? ? ? ? ? ? ?
lt lt lt(??)
gt gt gt(??)
amp amp (?)
apos apos (???)
quot quot (???)
11
??????
?????????? ????9-05.xml lt?xml version"1.0"
encoding"gb2312"?gt lt????gt lt??
??"??"gtlt???gtlt/??gt lt??gt????lt/??gt lt??gt??lt/?
?gt lt?? ??"??"gt2000lt/??gt lt/????gt
12
XML???????
  • ??XML??????????
  • ??CSS???
  • ??XSL???
  • ??XML??????

13
CSS???
????CSS??? ????9-06.css GREETING
font-size 48pt font-weight bold
??????CSS?XML?? ????9-07.xml lt?xml
version"1.0" encoding"GBK"?gt lt?xml-stylesheet
type"text/css" href"9-06.css"?gt ltGREETINGgt Chin
a lt/GREETINGgt
14
XSL????
??????XSL?XML?? ????9-08.xml
????XSL?? ????9-09.xsl
15
XML?????
??????XML????? ????9-10.htm
16
XML???????
  • ?XML??????,?????
  • W3C?DTD??
  • ????Scema??

17
DTD??????
  • ???????(Document Type Definition),??DTD?DTD?????XM
    L???,?????????????DTD?????,??????DTD???DTD
  • ??DTD

??????DTD ????9-13.xml
18
??DTD
??????DTD ????9-15.DTD
??????DTD ????9-16.xml
19
Schema????
??????Schema ????9-17.xml lt?xml
version"1.0"?gt ltSchema xmlns"urnschemas-microso
ft-comxml-data" xmlnsdt"urnschemas-microsoft-
comdatatypes"gt ltElementType name"books"gt ltelemen
t type"book"/gt lt/ElementTypegt ltElementType
name"book" dttype"int"/gt lt/Schemagt
??????Schema ????9-18.xml lt?xml
version"1.0"?gt ltbooks xmlns"x-schema9-17.xml"gt
ltbookgthellolt/bookgt lt/booksgt
20
?????
  • ????????
  • ASCII????ISO8859????Unicode?????UCS????????????GB
    2312?GBK?Big5

21
ASCII???
  • ASCII?????American Standard Code for Information
    Interchange(?????????),????????7????????ASCII?????
    ,????,?????????????7?????,??7???????????(8?)????(?
    ?????0)???????????????????????????
  • ??ASCII??????0,??,?ASCII??????????128(27)?????,???
    ??????????0-127???

22
ISO 8859???
  • ASCII??????????????(??????????),???Æ?Ë???Ö?Ü????
    ?????????????????????
  • ??????????,??????????????????1987?,??????ISO(Inter
    national Organization for Standardization)????????
    ISO8859-1????ISO8859-1??????Latin-1????Latin-1???
    ?ASCII?????????????????
  • ISO8859????????8?????????,?????256(28)?????,??,0-1
    27??????ASCII??????,128-255?????????????????????AS
    CII???????
  • ??ISO 8859-1,ISO 8859???????10???????????(8859-2?8
    859-10??8859-15),????4????(8859-11?8859-14)???????

23
Unicode???
  • Unicode??????????????Unicode??????????????????????
    ,?????????????????????????????????????????????????
    ????Unicode????????????????????????,??????????????
    ??????????????????????
  • ??????????????????????,?????????,?????????????,?Un
    icode????????????????,Unicode??????????????,??0-65
    535???????????????????????,?Unicode????,??????6553
    6??????,????????????????

24
?????
  • ???????,?????????
  • GB2312?GBK?Big5

25
GB2312???
  • GB?????GB2312-80???????????? ???,1980???,???????
    ?????,?????????????????(?????)?????????????P-Windo
    ws3.2???OS???GB2312????????,Windows
    95/98??GBK???????,?????GB2312?
  • GB?????6763??????682??????,???????3755?,????????
    3008?,???????????????????????????????????

26
GBK???
  • GBK??????????????UCS??????????????GBK?????1995?12?
    ???GBK??????????GB2312,??????21003????883?,????189
    4?????,??????????

27
BIG5???
  • BIG5????????????????????????????????????,????440?,
    ????5401??????7652?,??13060????

28
UTF-8???
  • UTF?Unicode/UCS Transformation Format??????Unicode
    /UCS ???????????,????Unicode/UCS??????????ASCII??L
    atin-1????????,??????????Unicode/UCSUTF-8?

29
UTF-16???
  • UTF-16??ISO/IEC 10646-1?Unicode???????????????????
    ???????,???????????????????????(BMP)??????????????
    BMP??????Unicode?????????
  • ISO 10646 ?????????,????????????????????????,Unico
    de ??????,?????????,???????????ISO 10646
    ????,?????????????????????(surrogate
    pairs)???????????????

30
?XML???HTML
??????HTML?? ????9-19.xml lt?xml
version"1.0"?gt lt?xml-stylesheet
type"text/css"?gt ltstudents xmlnsHTML"http//www
.w3.org/Profiles/XHTML-transitional"gt
ltstudentgt ltnamegtTomlt/namegt
ltsexgtmalelt/sexgt ltHTMLimg src"img.jpg"
width"200" height"100"/gt lt/studentgt lt/student
sgt
31
?XML???JavaScript??
??????JavaScript?? ????9-20.xml
32
XML?????????
  • ?Java??XML??????3??
  • ??DOM(Document Object Model)?????
  • ??SAX(Simple API for XML)?????
  • ??JDOM(Java Document Object Model)???????

33
????
  • DOM??????????????,??DOM?XML??????XML??????????????
    ?(?????????DOM?),?????????????????,???XML?????????
  • SAX?XML?????????SAX??????XML???????????,????????XM
    L?????????SAX????XML???????,????????,????????????,
    ?????XML?????,??SAX?????????????
  • JDOM???????DOM???????SUN????????????XML?????

34
???
  • ????????????,?????XML????????????????????Java?????
  • ?????????JAXP(Java API for XML
    Processing)?Xerces(Apache)?XML4J(IBM)?xalan?,?????
    ????SAX?DOM???JDOM????????SUN?????jdom??

35
DOM????
????DOM??? ????9-21.xml lt?xml version"1.0"
encoding"gb2312" ?gt ltaddressbookgt ltperson sex
"male"gt ltnamegt??lt/namegt
ltemailgtzhs_at_xml.net.cnlt/emailgt lt/persongt
ltperson sex "male"gt ltnamegt??lt/namegt
ltemailgtls_at_xml.net.cnlt/emailgt lt/persongt lt/address
bookgt
36
DOM??XML??
  • ?????????????
  • DocumentBuilderFactory dbf DocumentBuilderFactor
    y.newInstance()
  • ????????????????????????
  • DocumentBuilder builderdbf.newDocumentBuilder()
  • ?????DocumentBuilder?parse()??????XML?????????,??
    ??Document???Document???????XML???????
  • Document docbuilder.parse("candidate.xml")
  • ?????Document???getElementsByTagName()??,????????
    NodeList??,??XML??????????,????NodeList???item()??
    ??????????Node???
  • NodeList nl doc.getElementsByTagName("PERSON")
  • Element node(Element) nl.item(i)
  • ?????Node???getNodeValue()?????????????
  • node.getElementsByTagName("NAME").item(0).getFirst
    Child().getNodeValue()

37
JSP??DOM??XML??
????JSP??DOM??XML?? ????9-22.jsp
38
JSP??DOM??XML??
????JSP??DOM??XML?? ????9-23.jsp
39
SAX????
  • SAX?????????????DOM???,???????XML??,????????DOM?,?
    ?DOM?????Node???
  • ?????????,?????????,????????,??DOM????????????????
    ??????,???????,???????????DOM?????????,???????????
    ??SAX?

40
SAX??XML??
  • SAX????????????3??
  • ????DOM??,????????????
  • SAXParserFactory spf SAXParserFactory.newInstanc
    e()
  • ???,??????????
  • SAXParser saxParser spf.newSAXParser()
  • ???,?????XML??????,?????
  • saxParser.parse(new File(filename),new sax())

41
??????SAX?XML?????? ????9-23.java
42
JDOM????
  • JDOM???????Java XML JDOM?2002??JavaOne???JD
    OM??????Jason Hunter???????????JDOM??,????JDOM
    Makes XML Easy
  • ??????,JDOM????DOM??,JDOM????Java????DOM?SAX?????X
    ML??????????http//jdom.org????JDOM??????JDOM?jar?
    ??jdom.jar?

43
JDOM??
  • JDOM??????????DOM,??????SAX???,???????????????
  • ??,JDOM???????,????,?????
  • Attribute(??)?CDATA(??)?Comment(??)?Document(??)?E
    lement(??)Namespace(????)?ProcessingInstruction(??
    ??)?Text(??)

44
??JDOM??XML??
??????JDOM??XML?? ????9-24.jsp
45
??JDOM??XML???
??????JDOM??XML??? ????9-25.jsp
46
??JDOM??XML???
??????JDOM??XML??? ????9-26.jsp
47
(No Transcript)
48
??
  • ???????(eXtensible Markup Language,XML)???????????
    ?????
  • ??????XML????, XML???????CSS(Cascading Style
    Sheet,???????)?XSL(Extensible Style
    Language,???????)?Data Island(???)
  • ????JSP??XML???

49
????
  • 9-1. ??XML?HTML???????
  • 9-2. XML????????????????? ???XML?????????
  • 9-3. XML??????CSS?????????XSL?????????XML??????
  • 9-4. ?????????????
  • 9-5. ????DOM SAX JDOM(?????)
  • 9-6 ????Xerces xalan(?????)
  • 9-7 ????????9-01.xml???(????)
About PowerShow.com