客户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

ZJI(月付450元),香港华为云线路服务器、E3服务器起

ZJI发布了9月份促销信息,针对香港华为云线路物理服务器华为一型提供立减300元优惠码,优惠后香港华为一型月付仅450元起。ZJI是原来Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月更名为ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务,商家所选数据中心均为国内访问质量高的机房和线路,比如香港阿里云、华为...

Nocser:马来西亚独立服务器促销$60.00/月

Nocser刚刚在WHT发布了几款促销服务器,Intel Xeon X3430,8GB内存,1TB HDD,30M不限流量,月付$60.00。Nocser是一家注册于马来西亚的主机商,主要经营虚拟主机、VPS和马来西亚独立服务器业务,数据中心位于马来西亚AIMS机房,线路方面,AIMS到国内电信一般,绕日本NTT;联通和移动比较友好,联通走新加坡,移动走香港,延迟都在100左右。促销马来西亚服务器...

HostYun 新增美国三网CN2 GIA VPS主机 采用美国原生IP低至月15元

在之前几个月中也有陆续提到两次HostYun主机商,这个商家前身是我们可能有些网友熟悉的主机分享团队的,后来改名称的。目前这个品牌主营低价便宜VPS主机,这次有可以看到推出廉价版本的美国CN2 GIA VPS主机,月费地址15元,适合有需要入门级且需要便宜的用户。第一、廉价版美国CN2 GIA VPS主机方案我们可看到这个类型的VPS目前三网都走CN2 GIA网络,而且是原生IP。根据信息可能后续...

jsp技术为你推荐
51自学网站有哪些免费自学网bluestacksbluestacks怎么用依赖注入依赖注入是什么意思?微信如何建群微信怎么建立群显卡温度多少正常电脑显卡温度多少正常?bt封杀为什么现在网上许多BT下载都被封了?宕机宕机是什么意思?srv记录exchange 2010 自动发现需不需要srv记录blogcnblogcn网页无法正常显示,直接跳转http://www.7t7t.com/7?微信怎么看聊天记录微信在手机上怎么查看聊天记录
快速域名备案 云网数据 godaddy域名转出 阿里云代金券 东莞数据中心 天翼云盘 hktv 空间登入 我的世界服务器ip 美国盐湖城 net空间 畅行云 双11促销 网站防护 双十二促销 winserver2008 美国vpn服务器 阿里云宕机故障 国内免备案cdn 国外bt网站 更多