分布式系统-XMLppt精选课件

上传人:尔*** 文档编号:134831867 上传时间:2020-06-09 格式:PPT 页数:246 大小:2.14MB
返回 下载 相关 举报
分布式系统-XMLppt精选课件_第1页
第1页 / 共246页
分布式系统-XMLppt精选课件_第2页
第2页 / 共246页
分布式系统-XMLppt精选课件_第3页
第3页 / 共246页
分布式系统-XMLppt精选课件_第4页
第4页 / 共246页
分布式系统-XMLppt精选课件_第5页
第5页 / 共246页
点击查看更多>>
资源描述

《分布式系统-XMLppt精选课件》由会员分享,可在线阅读,更多相关《分布式系统-XMLppt精选课件(246页珍藏版)》请在金锄头文库上搜索。

1、 1 XML StevenHolzner SamsTeachYourselfXMLin21Days ThirdEdition 2003 2 1 XML基础 3 MarkupLanguages HelloFromHTMLAnHTMLDocumentThisisanHTMLdocument 标记是文档中数据的描述和解释 4 XML eXtensibleMarkupLanguage元语言 创建标记语言的语言 5 ElementsarenestedRootelementcontainsallothers Element ortag names Example elements Rootelement

2、Emptyelement attributes declaration 6 MoreTerminology Johnisanicefellow21MainSt Openingtag Closingtag Whatisopenmustbeclosed Nestedelement childofPerson ParentofAddress Ancestorofnumber standalone text notusefulasdata ChildofAddress DescendantofPerson ContentofPerson 7 IE中浏览XML文档 8 AnXMLDocumentUsin

3、gaStyleSheet Johnisanicefellow21MainSt 9 ch01 04 css Person display block font size 18pt color 0000ff text align left 10 使用JavaScript抽取数据 HelloFromXMLThisisanXMLdocument 11 使用JavaScript抽取数据 RetrievingdatafromanXMLdocumentfunctiongetData xmldoc document all firstXML XMLDocument nodeDoc xmldoc documen

4、tElement nodeHeading nodeDoc firstChild outputMessage Heading nodeHeading firstChild nodeValue message innerHTML outputMessage 12 使用JavaScript抽取数据 RetrievingdatafromanXMLdocument 13 使用JavaScript抽取数据 14 使用Java从XML文档中抽取数据 importjavax xml parsers importorg w3c dom importjava io publicclassch01 06 stati

5、cpublicvoidmain String argv try DocumentBuilderFactorydbf DocumentBuilderFactory newInstance DocumentBuilderdb null try db dbf newDocumentBuilder catch ParserConfigurationExceptionpce Documentdoc null doc db parse ch01 02 xml 15 使用Java从XML文档中抽取数据 for Nodenode doc getDocumentElement getFirstChild nod

6、e null node node getNextSibling if nodeinstanceofElement if node getNodeName equals heading StringBufferbuffer newStringBuffer for Nodesubnode node getFirstChild subnode null subnode subnode getNextSibling if subnodeinstanceofText buffer append subnode getNodeValue System out println buffer toString

7、 catch Exceptione e printStackTrace 16 使用Java从XML文档中抽取数据 javach01 06HelloFromXML 17 Well formedXMLDocuments MusthavearootelementEveryopeningtagmusthavematchingclosingtagElementsmustbeproperlynestedisano noAnattributenamecanoccuratmostonceinanopeningtag Ititoccurs Itmusthaveavalue booleanattrs likein

8、HTML arenotallowed Thevaluemustbequoted with or XMLprocessorsarenotsupposedtotryandfixill formeddocuments unlikeHTMLbrowsers 18 ValidXMLDocuments HelloFromXMLThisisanXMLdocument 19 ValidXMLDocument AvalidXMLdocumentisdefinedbytheW3Casawell formedXMLdocumentwhichalsoconformstotherulesofaDocumentTypeD

9、efinition DTD oranXMLSchema ski m XSD 20 XML应用 XML用于存储 传输 结构化数据纯文本格式使它容易被在互联网上传输并被不同平台上的应用所处理过去5年中 已经出现了上百种XML子语言 21 使用MathML显示4x2 5x 6 0 4x 6 0 22 在Amaya浏览器中显示MathML文档 23 XHTML ExtensibleHypertextMarkupLanguage更加严格允许增加自己的标记HTML4 01 当前版本 24 AnXHTMLDocument AnXHTMLPageWelcometoXHTML ThisisanXHTMLdocu

10、ment Prettycool eh 25 在IE中显示 26 AnSVGDocument SVGExample 27 练习 validXML文档一定是well formed吗 well formedXML文档一定是valid吗 28 编辑XML文档 XML编辑器XMLSpyVisualStudioXMLDesignerXRayXML浏览器IE MostpowerfulgeneralJumbo CMLbrowser 29 Jumbo 30 XMLValidators MakesureitiswellformedandvalidScholarlyTechnologyGroup svalidato

11、rMicrosoft sVisualStudio NET 31 error xml HelloFromXMLThisisanXMLdocument 32 33 XMLvalidationinVisualStudio NET 34 建立一个完整的XML文档 HelloFromXMLThisisanXMLdocument 35 XML文档 PrologsXMLdeclarationsProcessinginstructionsElementsandattributesCommentsCDATAsectionsEntities 36 字符编码问题 ASCII仅有256个字符Chinese Armen

12、ian Hebrew Thai Tibetan从数量上 通用上 ASCII不能在Web上使用Unicode http www unicode org 65 536个字符前256个对应ASCII但让所有的软件转去支持Unicode太困难UCSTransformationFormat 8 UTF 8 37 UTF 8 所有ASCII字符的编码保持不变 8bit 其它Unicode字符使用2字节 直至6字节编码W3CrequiresallXMLprocessorstosupportbothUTF 8 UTF 16大部分支持UTF 8 38 字符实体引用 HelloFromXMLThistextisi

13、nsideaelement 39 字符实体引用 40 字符实体引用 Replacedwith 41 实体 实体是一大段文本的别名假如你为你的信件署名定义了一个实体lettersign 它代表下面这一大段文本 张三某网络公司销售部门北京市海淀区中关村88号 100000 42 实体 邮件 收件人 李四 收件人 主题 hello 主题 正文 晚上吃饭 lettersign 正文 邮件 43 一般实体和参数实体 一般实体声明 ENTITYlettersign 张三某网络公司销售部门北京市海淀区中关村88号 100000 参数实体声明 ENTITY 实体名 文本内容 44 实体引用 的用法都会引起错误

14、 尽管在一个实体中可以再引用其它实体 但是不能出现循环引用 也就是说 一个实体不能引用它自己 同样 也不能出现实体A引用实体B 然后实体B再反过来引用实体A的情况 实体引用不能在DOCTYPE声明中出现 实体引用的文本必须是形式良好的XML 45 张三 A公司 李四B公司 B公司地址 地址 王五 B公司 B公司地址 地址 一旦哪个公司搬家了 只须改变实体声明中有关该公司的地址 所有这个公司的联系人的地址也就都改过来了 46 空白 Spaces carriagereturns linefeeds andtabsarealltreatedaswhitespace HelloFromXMLThisi

15、sanXMLdocument heading HelloFromXMLThisisanXMLdocument 47 Prologs 序言 XMLdeclarationsXMLcommentsprocessinginstructionswhitespacedoctypedeclarations 48 KellyGraceOctober15 2005Printer XMLDeclaration XMLComments ProcessingInstruction由处理器定义 RootElement Element 属性 49 CDATA CDATAstandsforcharacterdata PCD

16、ATAstandsforparsedcharacterdata 50 Here showtheelementstarts KellyGraceOctober15 2005Printer111 111 00 51 InternetExplorertreatsthisCDATAsectionasunparsedtext 52 练习 一个文本编辑器保存XML文档时 并不提示字符集 该编辑器是否可用 把文本数据 Thisisaelement 包含在元素中 怎样做才不会迷惑XMLprocessor XMLprolog可以包含哪些项目 53 XMLNamespaces 解决文档内和文档间名字冲突的机制NamespacedeclarationNamespace 符号串 通常为URLPrefix 名字空间的缩写 相当于别名Actualname elementorattribute prefix nameDeclarations prefixes作用范围 scope 与begin end类似Example backpackcyberpet Defaultnamespace toynamespace re

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号