您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > webservice讲课课件
XMLSchemaXML模式提纲•XML名称空间•XML模式类型元素属性创建复合内容元素模式注释创建序列创建选择XML名称空间•作用避免标记名称冲突•格式:xmlns:prefixlibraryxmlns:book=””booktitleEarthquakesforLunch/title/book/libraryXML名称空间book:libraryxmlns:book=:steve=””book:bookbook:titleEarthquakesforLunch/book:title/book:booksteve:reviewThisbookwasOK,nogreatshakes./steve:review/book:library创建本地名称空间book:libraryxmlns:book=:bookbook:titleEarthquakesforLunch/book:title/book:booksteve:reviewxmlns:steve=””steve:ID=”1000034”ThisbookwasOK,nogreatshakes./steve:review/book:library缺省名称空间?xmlversion=”1.0”?!DOCTYPEhtmlPUBLIC“-//W3C//DTDXHTML1.0Transitional//EN”“”htmlxmlns=””xml:lang=”en”lang=”en”headtitleEmbeddingMathMLInXHTML/title/headbodycenterh1EmbeddingMantMLInXHTML/h1/centerHereistheMathML/bodyDTD与名称空间(示例1)?xmlversion=“1.0”standalone=“yes”?!DOCTYPEDOCUMENT[!ELEMENTDOCUMENT(CUSTOMER)*!ATTLISTDOCUMENTxmlnsCDATA#FIXED“”!ELEMENTCUSTOMER(NAME,DATE,ORDERS)!ELEMENTNAME(LAST_NAME,FIRST_NAME)!ELEMENTLAST_NAME(#PCDATA)!ELEMENTFIRST_NAME(#PCDATA)!ELEMENTDATE(#PCDATA)!ELMENTORDERS(ITEM)*!ELMENTITEM(PRODUCT,NUMBER,PRICE)!ELEMENTPRODUCT(#PCDATA)!ELEMENTNUMBER(#PCDATA)]DTD与名称空间(示例1)DOCUMENTxmlns=””CUSTOMERNAMELAST_NAMESmith/LAST_NAMEFIRST_NAMESam/FIRST_NAMENAMEDATEOctober15,2001/DATEORDERSITEMPRODUCTTomatoes/PRODUCTNUMBER8/NUMBERPRICE$1.25/PRICE/ITEM/ORDERS/CUSTOMER/DOCUMENTDTD与名称空间(示例2)?xmlversion=“1.0”standalone=“yes”?!DOCTYPEdoc:DOCUMENT[!ELEMENTdoc:DOCUMENT(doc:CUSTOMER)*!ATTLISTdoc:DOCUMENTxlmns:docCDATA#FIXED“”!ELEMENTdoc:CUSTOMER(doc:NAME,doc:DATE,doc:ORDERS)!ELEMENTdoc:NAME(doc:LAST_NAME,doc:FIRST_NAME)!ELEMENTdoc:LAST_NAME(#PCDATA)!ELEMENTdoc:FIRST_NAME(#PCDATA)!ELEMENTdoc:DATE(#PCDATA)!ELMENTdoc:ORDERS(doc:ITEM)*!ELMENTdoc:ITEM(doc:PRODUCT,doc:NUMBER,doc:PRICE)!ELEMENTdoc:PRODUCT(#PCDATA)!ELEMENTdoc:NUMBER(#PCDATA)]DTD与名称空间(示例2)doc:DOCUMENTxmlns:doc=””doc:CUSTOMERdoc:NAMEdoc:LAST_NAMESmith/doc:LAST_NAMEdoc:FIRST_NAMESam/doc:FIRST_NAME/doc:NAMEdoc:DATEOctober15,2001/doc:DATEdoc:ORDERSdoc:ITEMdoc:PRODUCTTomatoes/doc:PRODUCTdoc:NUMBER8/doc:NUMBERdoc:PRICE$1.25/doc:PRICE/doc:ITEM/doc:ORDERS/doc:CUSTOMER/doc:DOCUMENTSchema与命名空间xsd:schematargetNamespace=':xsd=':ACC=':elementname=‘orders’xsd:complexTypexsd:elementname=‘order’type='xsd:positiveInteger'/xsd:elementname=‘product'type='ACC:productType'/xsd:simpleTypename=‘ACC:productType'base='xsd:string'xsd:patternvalue='[A-Z]{1}d{6}'//xsd:simpleType/XSD:complexType/XSD:element/xsd:schemaXMLSchema•可以和使用DTD一样定义文档的语法•定义每个元素内容的实际数据类型•从其他模式继承语法•为模式加上注释•创建简单和复杂的数据类型•定义元素可能的出现次数的最大值和最小值•创建属性组,限制元素值的范围•限制元素值的范围•限制其他模式可以从你的模式中继承哪些东西•要求属性和元素值必须唯一等等文档示例?xmlversion=”1.0”?transactionborrowDate=”2001-01-15”Lenderphone=”607.555.2222”nameDougGlass/namestreet416DiskDriver/streetcityMedfield/citystateMA/state/LenderBorrowerphone=”310.555.1111”nameBrittaRegensburg/namestreet219UnionDriver/streetcityMedfield/citystateCA/state/BorrowernoteLenderwantsthesebackintwoweeks!/note文档示例booksbookbookID=”123-4567-890”bookTitleEarthquakeforBreakfas/bookTitlepubDate2001-10-20/pubDatereplacementValue15.95/replacementValuemaxDaysOut14/maxDaysOut/bookbookbookID=”123-4567-891”bookTitleAvalanchesforLauch/bookTitlepubDate2001-10-21/pubDatereplacementValue19.99/replacementValuemaxDaysOut14/maxDaysOut/book文档示例bookbookID=”123-4567-892”bookTitleMeteorShowersforDinner/bookTitlepubDate2001-10-22/pubDatereplacementValue11.95/replacementValuemaxDaysOut14/maxDaysOut/bookbookbookID=”123-4567-893”bookTitleSnackingonVolcanoes/bookTitlepubDate2001-10-23/pubDatereplacementValue17.99/replacementValuemaxDaysOut14/maxDaysOut/book/books/transaction相应模式示例xsd:schemaxmlns:xsd=””xsd:annotationxsd:documentationBookborrowingtransactionschema./xsd:documentation/xsd:annotationxsd:elementname=”transaction”type=”transactionType”/xsd:complexTypename=”transactionType”xsd:elementname=”Lender”type=”address”xsd:elementname=”Borrower”type=”address”xsd:elementref=”note”minoccurs=”0”/xsd:elementname=”books”type=”books”/xsd:attributename=”borrowDate”type=”xsd:date”//xsd:complexType相应的模式示例xsd:elementname=”note”type=”xsd:string”/xsd:complexTypename=”address”xsd:elementname=”name”type=”xsd:string”xsd:elementname
本文标题:webservice讲课课件
链接地址:https://www.777doc.com/doc-3675389 .html