unit3 Simple API for XML(SAX)课件.ppt


文档分类:IT计算机 | 页数:约44页 举报非法文档有奖
1/44
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/44
文档列表 文档介绍
该【unit3 Simple API for XML(SAX)课件 】是由【yzhlya】上传分享,文档一共【44】页,该文档可以免费在线阅读,需要了解更多关于【unit3 Simple API for XML(SAX)课件 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。(SAX)
WhatThisUnitIsAbout
ThisunitdescribestheSimpleAPLforXML(SAX)whichisanevent-drivenAPItoaccessXMLdocuments.
WhatYouShouldBeAbletoDo
Aftercompletingthisunit,youshouldbeableto:
·ExplainhowtousetheSimpleAPIforXML
·ExplainhowSAXeventscanbeusedtoprocessadocument
·WriteSAXeventhandlersandregisterthehandlersusingtheParserinterface
HowYouWillCheckYourProgress
Accountability:
·Labexercise
References
·URLSAXSpecification
·URLListofApplicationsthatsupportSAX

Objectives
·UnderstandhoweventsareusedintheSAXAPItoprocessanXMLdocument
·UnderstandtheJavaartifactsthatarepartoftheSAXAPIandtheclassesthatareprovidedbytheprocesingapplication
·WritesimpleeventhandlerstoprocessanXMLdocument
·Usetheparserinterfacetoregistertheeventhandlersandstartparsing
Figure3-(in761300)

SimpleAPIforXML(SAX)
·StandardAPIforXMLparsers
·Event-drivenAPIforaccessingXMLdocuments-Applicationregistershandlerforvariousevents
·Java,C++,PythonandCOMimplementationsavailable
·(releasedMay1998)
Figure3-(SAX)(in761302)
Notes

SAXEventsExample
<?xmlversion=""?>
<personnel>
<personid="">
<name>
<family>Boss</family>
<given>Big</given>
</name>
<email>******@</email>
</person>
</personnel>
Figure3-(in761306)
Notes

SAXEventsExample
·startDocument·characters-Bing
·starElement-personnel·endElement-given
·starElement-person·endElement-name
·starElement-name·startElement-email
·starElement-family·characters-
·endElement-family·endElement-email
·starElement-given·endElement-person
·charactes-Boss·endElement-personnel
·starElement-given·endDocument
Figure3-(in761308)
Notes

SAXClassesandInterfaces
·InterfacesimplementedbyXMLparserorSAXdriver-Parser,AttributeListandLocator(optional)
·InterfacesimplementedbyXMLapplication-DocumentHandler,DTDHandler,EntityResolver,ErrorHandler
·XMLapplicationclass-HandlerBase
·ImplementsallfourXMLapplicationinterfaces
·Providesdefaultbehavior
·ForJava:
Figure3-(in761310)
Notes

ParserInterfaceMethods
Figure3-(in761314)
Notes

SAXHelperClass-InputSource
·Encapsulatesaninputsource
·InputSourcecanbecreatedusingByteStream,CharacterSteamorsystemidentifier
Figure3--InputSource(in761316)
Notes

UsingSAXParserInerface
//Createparser(calledSAXParserinXML4J)
StringparserClass="";
Parserparser=(parserClass);
//Registerhandler(s)
HandlerBasemyHandler=newMyHander();
(myHandler);
(myHandler);
//ParseXMLdocumentbyspecifyingURI
(xmlDocumentURI);
Figure3-(in761318)
Notes

DocumentHandlerInterfaceMethods
Figure3-(in761322)
Notes

unit3 Simple API for XML(SAX)课件 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数44
  • 收藏数0 收藏
  • 顶次数0
  • 上传人yzhlya
  • 文件大小1.58 MB
  • 时间2022-12-01