客户jsp技术

jsp技术  时间:2021-02-26  阅读:()
Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com1XMLAllenLongEmail:allen@huihoo.
comhttp://www.
huihoo.
com2004-04Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com2内容安排XML基础Java+XML简介JavaAPIforXML–JAXP(ProcessingAPI)–JAXB(ProjectAdelard)–JAXM(MessagingAPI-ebXML)–XML和Java2平台,企业版Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com3XML是什么XML–ExtensibleMarkupLanguageBaseduponHTMLDescribeyourowntagsUsesDTD(DocumentTypeDefinition)todescribethedataXMLisnotareplacementforHTMLXMLisalanguageforcreatingotherlanguagesDocumentsfollowthecustomlanguageauserdevelopsfromXMLLabeledinformationinXMLcanbereusedNeedtofollowtherulesaccordinglyHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com4HTML存在的问题DonotgiveinformationaboutcontentofthewebpageHardtobeabletoreusethisinformationHTMLarehardtodisplayfrombrowser'spointofviewbecauseofHTML'ssimplicityLimitedinareasofformattinganddynamiccontentHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com5JAVA与XML完美结合1.
Java平台是一种跨平台的编程环境2.
XML是一种跨平台的数据格式3.
几乎所有的XML工具使用的都是Java编程语言4.
与其他语言相比,Java平台提供了更好的XML支持Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com6JAXP-Java平台上的解析API用户应用参考解析器其他解析器JAXP接口Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com7JAXP用于解析的瘦型、轻量级API用于转换XML文档的API可嵌入式的解析器和XSLT引擎解析XML使用:事件驱动(SAX)基于树型结构(DOM)XSL转换Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com8SAXSimpleAPIforXML的缩写串行存取文档轻量级、快速编程较难仅用于串行存取org.
xml.
sax.
*Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com9SAX对应的HandlerXML文档解析器事件输入Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com10JAXP/SAX代码例子01importjava.
xml.
parsers.
*;02importorg.
xml.
sax.
*;0304SAXParserFactoryfactory=05SAXParserFactory.
newInstance();06factory.
setValidating(true);07SAXParserparser=factory.
newSAXParser();08parser.
parse("config.
xml",handler);0910//canalsoparseInputStreams,Files,and11//SAXinputsourcesHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com11DOMDocumentObjectModel的缩写通过树型结构存取XML文档由元素节点和文本节点组成可以在树的某个节点上向前或向后移动与SAX相比需要更大的内存org.
w3c.
dom.
*Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com12DOM解析器创建的树输入XML文档Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com13JAXP/DOM代码例子01importjava.
xml.
parsers.
*;02importorg.
w3c.
dom.
*;0304DocumentBuilderFactoryfactory=05DocumentBuilderFactory.
newInstance();06factory.
setValidating(true);07DocumentBuilderbuilder=08factory.
newDocumentBuilder();09Documentdoc=10builder.
parse("config.
xml");1112//canalsoparseInputStreams,Files,and13//SAXinputsourcesHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com14JAXP中的XSLTAPIjavax.
xml.
transformXSLT处理器的基本接口集定义了TransformerFactory和Transformer类定义了Templates,SourceandResult接口Templates表示处理指令在Source和Result接口中可以使用SAX,DOM和streamHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com15Transform的代码例子01importjava.
xml.
transform.
*;0203Transformertrans;04TransformerFactorfac=new05TransformerFactory.
newInstance();06try{07//Createatranformforastylesheet08trans=fac.
newTransformer(09newStreamSource(stylesheet));10//ApplytransformtoSystem.
out11trans.
transform(newStreamSource(source),12newStreamResult(System.
out));13}catch(Exceptione){14//handleerror15}Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com16解析器的指定使用系统属性查找Factoryjavax.
xml.
parsers.
SAXParserFactoryjavax.
xml.
parsers.
DocumentBuilderFactoryjavax.
xml.
parsers.
TransformerFactory通过改变属性可以使用任意的解析器$JAVA_HOME/lib/jaxp.
properties文件Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com17改变属性Command:java-Djavax.
xml.
parsers.
SAXParserFactory=MyParserFactoryMyClassCode:System.
setProperty("javax.
xml.
parsers.
SAXParserFactory","foo.
bar.
MyParserFactory");Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com18用于XML绑定的JavaAPI-JAXBHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com19XML数据绑定XML=可移动的数据XML代表的数据没有任何意义模式(Schemas)为XML增加了意义绑定使XML可以容易地在程序中使用UnmarshalMarshalXML消息对象Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com20XML=没有意义的数据Brown91/2它们相同吗Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com21模式(Schemas)为XML增加了意义模式=XML消息的语义和语法描述XML消息对象类XML模式遵从:实例化:Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com22在程序中使用XML对应XML消息的类publicclassShoeOrder{publicShoeOrder(Stringid,Stylestyle,Stringcolor,Stringsize);publicStringgetId();publicvoidsetId(Stringid);publicStylegetStyle();publicvoidsetStyle(Stylestyle);publicStringgetColor();publicvoidsetColor(Stringcolor);publicStringgetSize();publicvoidsetSize(Stringsize);}Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com23在程序中使用XMLMarshalling/unmarshalling代码PublicvoidacceptOrder(InputStreamin){ShoeOrderso=unmarshal(in);WarehouseDB.
submit(so);}编写unmarshalHuihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com24在程序中使用XML如何编写unmarshal使用SAX!
privatestaticShoeOrdernewOrder=null;staticclassDocHandlerimplementsDocumentHandler{publicvoidsetDocumentLocator(Locatorl){}publicvoidstartDocument(){}publicvoidendDocument(){}publicvoidignorableWhitespace(char[]cbuf,intoffset,intlen){}publicvoidprocessingInstruction(Stringtarget,Stringdata){}ShoeOrderso=null;Stringcur=null;publicvoidstartElement(Stringname,AttributeListal){if(name.
equals("ShoeOrder")){so=newShoeOrder();for(inti=0,n=al.
getLength();iJSP技术互相补充–操作XML以完成不同的任务–来自XML的数据数据库查询–通用数据+XSLT作为表现层Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com38产生XMLWAP客户RIMPalmVPalmVII客户转换器XML.
.
.
.
.
.
JSP页面Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com39多客户译码器WAP客户RIMPalmVPalmVII客户转换器.
.
.
.
.
.
HTML客户WML客户译码器XML网络层Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com40多客户XSLTStylesheetWAP客户RIMPalmVPalmVII客户转换器.
.
.
.
.
.
WAP客户RIMPalmVPalmVII客户转换器.
.
.
.
.
.
HTML客户WML客户XSLTStylesheetXML网络层Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com41用于XML注册的JavaAPI---JAXRJavaAPIforXMLRegistries注册是B2B协作中的一个第三方工具JAXR是用于XML注册的统一的应用编程接口ebXML,UDDI等等.
Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com42基于RPC方式处理XML的JavaAPIJavaAPIforXMLbasedRPC用途Marshalling和Unmarshalling参数将基于XML的调用定义映射为Java接口、类和方法,或者进行反向映射将会成为W3C的XML协议(XP)Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com43JDOMJDOM设计体系–隐藏了XML的复杂性–利用了Java2语言的强大功能–利用了方法过载、CollectionsAPIs、Reflection、弱引用–提供类型转换JDOM与DOM的区别就在于代表Document(文档)、Elements(元素)和Attributes(属性)的JDOM的类是模块化的,更像传统的JAVA类包说明org.
jdomDOM的JDOM实现org.
jdom.
adapters处理XML解析器的JDOM适配器org.
jdom.
input内含使用DOM或SAX创建文档的类org.
jdom.
output内含向流发送DOM树或创建SAX2事件的类Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com44内容回顾XML基础Java+XML简介JavaAPIforXML–JAXP(ProcessingAPI)–JAXB(ProjectAdelard)–JAXM(MessagingAPI-ebXML)–XML和Java2平台,企业版Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com45总结Java+XML代表了可移植的数据和行为Java+XML关注–标准体–通过JCP的JavaAPIs–鼓励标准的实现–利用已存在的平台—Java2,J2EE,JSP等等Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com46参考资料http://www.
w3.
org/XML/w3c的xml站点http://www.
xml.
org/xml站点http://java.
sun.
com/xmlsun公司的xml站点http://www.
huihoo.
com国内一个关于中间件的专业站点Huihoo-EnterpriseOpenSourcehttp://www.
huihoo.
com47结束谢谢大家!
Allen@huihoo.
comhttp://www.
huihoo.
com

TMThosting夏季促销:VPS月付7折,年付65折,独立服务器95折,西雅图机房

TMThosting发布了一个2021 Summer Sale活动,针对西雅图VPS主机提供月付7折优惠码,年付65折优惠码,独立服务器提供95折优惠码,本轮促销活动到7月25日。这是一家成立于2018年的国外主机商,主要提供VPS和独立服务器租用业务,数据中心包括美国西雅图和达拉斯,其中VPS基于KVM架构,都有提供免费的DDoS保护,支持选择Windows或者Linux操作系统。Budget ...

pigyun25元/月,香港云服务器仅起;韩国云服务器,美国CUVIP

pigyun怎么样?PIGYun成立于2019年,2021是PIGYun为用户提供稳定服务的第三年,期待我们携手共进、互利共赢。PIGYun为您提供:香港CN2线路、韩国CN2线路、美西CUVIP-9929线路优质IaaS服务。月付另有通用循环优惠码:PIGYun,获取8折循环优惠(永久有效)。目前,PIGYun提供的香港cn2云服务器仅29元/月起;韩国cn2云服务器仅22元/月起;美国CUVI...

阿里云金秋上云季,云服务器秒杀2C2G5M年付60元起

阿里云(aliyun)在这个月又推出了一个金秋上云季活动,到9月30日前,每天两场秒杀活动,包括轻量应用服务器、云服务器、云数据库、短信包、存储包、CDN流量包等等产品,其中Aliyun轻量云服务器最低60元/年起,还可以99元续费3次!活动针对新用户和没有购买过他们的产品的老用户均可参与,每人限购1件。关于阿里云不用多说了,国内首屈一指的云服务器商家,无论建站还是学习都是相当靠谱的。活动地址:h...

jsp技术为你推荐
有趣的广告比较有趣的广告词有哪些无线路由器限速设置wifi怎么设置限速天天酷跑刷积分教程天天酷跑积分怎么刷最快?网站运营刚创业的网站运营怎么做?百度手写百度为什么没有了在线手写输入法ios7固件下载ios 7及以上固件请在设备上点信任在哪点iphone6上市时间iphone6什么时候上市,价格是多少?网络虚拟机VMware虚拟机三种网络模式的区别有哪些?声母是什么声母是什么?单韵母是什么网站推广外链网站推广发外链,外链内容怎么确定
虚拟主机99idc photonvps zpanel 免费主机 nerd 12306抢票助手 好看的桌面背景图 租空间 华为网络硬盘 gspeed softbank邮箱 100m空间 免费吧 qq对话框 免费申请个人网站 全能空间 江苏双线 带宽测试 阿里云邮箱怎么注册 privatetracker 更多