- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
XML标准
展开查看详情
1 .XML Standards, Xpath , and XQuery What is XML? How is it Used Today? HL7 and CDA, CCR Biomedical InformaticsStandards MeSH ICD9 and ICD9-CM (Intl. Classification Diseases) ICD10 and ICD10-CM XML EBNF Supplemental Material on XPath and Xquery Web Server Programming CSE135 Winter 2004 db.ucsd.edu/static/CSE134A/XML-XQuery-XSLT.ppt Query Languages for XML http://infolab.stanford.edu/~ullman/fcdb/aut07/slides/xpath-xquery-xslt.ppt
2 .What is one Possible Solution? Standards and Usage of XML XML Used in Myriad of Context Modeling and Information Exchange (XML Schemas and Instances) XML Standards XACML – Access Control Markup Language OWL – Web Ontology Language HL7/CDA What is/will be its Eventual Role in BMI?
3 .Overview of XML XML Overview, Tags, schema. XML Query Languages: XPath &XQuery XML Data Models Biomedical Information and Databases BMI Standards and Examples: HL7 and CDA Survey of Technology
4 .XML Overview Continued eXtensible Markup Language Similar to HTML Meta-language that describes the content of the document (self-describing) XML is primarily used as a data storage and interchange medium XML exists in plain text format, however it may be compressed, or altered for transfer
5 .XML Overview Continued There are no predefined data (tags), or grammer inherently in XML XML tags give an XML document structure and meaning Available tags are defined by a schema. All tags in an XML document come in pairs, open and close Tags are completely nested, and there is no ambiguity in their order
6 .XML: Extensible Markup Language Data sources Database storing data for Internet applications Utilized to Store Information for Other Apps Emerging Standards across Domains Hypertext documents Common method of specifying contents and formatting of Web pages XML data model
7 .Structured & Semistructured Data Structured data Represented in a strict format Example: information stored in databases Semistructured data Has a certain structure Not all information collected will have identical structure
8 .Sample XML Structure
9 .
10 .XML Tags XML tags may have an element field which is used to store information within the tag or Meta-data Plain text can be placed between tags and this text is not parsed CDATA is character data This means that any string of non-markup characters is legal as part of the attribute The ENTITY attribute type indicates that the attribute will represent an external entity in the document itself The ID attribute type if you want to specify a unique identifier for each element.
11 .XML Schemas Schema information mixed in with data values Self-describing data May be displayed as a directed graph Labels or tags on directed edges represent: Schema names Names of attributes Object types (or entity types or classes) Relationships
12 .XML Schema The structure of an XML document is defined by its schema. Dozens on languages to define XML schema: DTD W3C (XSD) NG - Relax This file can validate any instance of an XML document against it self. This file, or schema also defines allowable tags.
13 .Schema Example (XSD) <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="shiporder"> <xs:complexType> <xs:sequence> <xs:element name="orderperson" type="xs:string"/> <xs:element name="shipto"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="item" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string" minOccurs="0"/> <xs:element name="quantity" type="xs:positiveInteger"/> <xs:element name="price" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="orderid" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:schema>
14 .Sample XML Structure XML employs a tree structure model for representing data shiporder orderperson shipto name address city country item title name quantity price orderid
15 .XML Hierarchical Data Model Elements and attributes Main structuring concepts used to construct an XML document Complex elements Constructed from other elements hierarchically Simple elements Contain data values XML tag names Describe the meaning of the data elements in the document
16 .XML Hierarchical Data Model Elements and attributes Main structuring concepts used to construct an XML document Complex elements Constructed from other elements hierarchically Simple elements Contain data values XML tag names Describe the meaning of the data elements in the document
17 .XML Hierarchical Data Model Tree model or hierarchical model Main types of XML documents Data-centric XML documents Document-centric XML documents Hybrid XML documents Schemaless XML documents Do not follow a predefined schema of element names and corresponding tree structure XML attributes Describe properties and characteristics of the elements (tags) within which they appear May reference another element in another part of the XML document Common to use attribute values in one element as the references
18 .XML Documents and Schema Well formed Has XML declaration Indicates version of XML being used as well as any other relevant attributes Every element must matching pair of start and end tags Within start and end tags of parent element DOM (Document Object Model) Manipulate resulting tree representation corresponding to a well-formed XML document
19 .XML Documents and Schema SAX (Simple API for XML) Processing of XML documents on the fly Notifies processing program through callbacks whenever a start or end tag is encountered Makes it easier to process large documents Allows for streaming
20 .XML Schema Identify specific set of XML schema language elements (tags) being used Specify a file stored at a Web site location XML namespace Defines the set of commands (names) that can be used
21 .XML Schema XML schema concepts: Description and XML namespace Annotations, documentation, language Elements and types First level element Element types, minOccurs, and maxOccurs Keys Structures of complex elements Composite attributes
22 .XML Schema XML schema concepts: Description and XML namespace Annotations, documentation, language Elements and types First level element Element types, minOccurs, and maxOccurs Keys Structures of complex elements Composite attributes
23 .XML Schema XML schema concepts: Description and XML namespace Annotations, documentation, language Elements and types First level element Element types, minOccurs, and maxOccurs Keys Structures of complex elements Composite attributes
24 .XML Documents and Schema Valid Document must be well formed Document must follow a particular schema Start and end tag pairs must follow structure specified in separate XML DTD (Document Type Definition) file or XML schema file DTD is Outmoded in Current Usage Schemas Dominate .. XML schema language Standard for specifying the structure of XML documents Uses same syntax rules as regular XML documents Same processors can be used on both
25 .XML Languages Two query language standards XPath Specify path expressions to identify certain nodes (elements) or attributes within an XML document that match specific patterns XQuery Uses XPath expressions but has additional constructs
26 .XPath: Specifying Path Expressions in XML XPath expression Returns a sequence of items that satisfy a certain pattern as specified by the expression Either values (from leaf nodes) or elements or attributes Qualifier conditions Further restrict nodes that satisfy pattern Separators used when specifying a path: Single slash (/) and double slash (//)
27 .XPath: Specifying Path Expressions in XML Attribute name prefixed by the @ symbol Wildcard symbol * Stands for any element Example: /company/*
28 .XPath: Specifying Path Expressions in XML Axes Move in multiple directions from current node in path expression Include self, child, descendent, attribute, parent, ancestor, previous sibling, and next sibling Main restriction of XPath path expressions Path that specifies the pattern also specifies the items to be retrieved Difficult to specify certain conditions on the pattern while separately specifying which result items should be retrieved
29 .Querying XML - XPath Many languages to query XML XPath and XQuery are W3C standards Xpath is a compact method of traversing previous tree Designed to facilitate use via URL/URIs / shiporder /item/name ← view all items names Extensible to add user defined behaviors Treats each tag as a node in the tree