ACG 4401 XML Schemas XML Namespaces XLink.

Slides:



Advertisements
Similar presentations
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
Advertisements

1 XML DTD & XML Schema Monica Farrow G30
A Simple Schema Design. First Schema Design Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty extroverted beagle Peppermint.
XML e X tensible M arkup L anguage 1/23.
Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti.
Unit 4 – XML Schema XML - Level I Basic.
Introduction to XML This material is based heavily on the tutorial by the same name at
ACG 4401 XML Schemas XML Namespaces XLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
ACG 4401 XML Schemas XML Namespaces XMLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation XML Schema 1 Lecturer.
CSE4500 Information Retrieval Systems XML Schema – Part 1.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Schemas Ellen Pearlman Eileen Mullin Programming the Web Using XML.
Skip 2007 Current Issues in MIS The XML Language Foundation f - Clinton E. White, Jr Professor of Accounting & MIS Lerner College of B&E University.
Session IV Chapter 9 – XML Schemas
Of 33 lecture 3: xml and xml schema. of 33 XML, RDF, RDF Schema overview XML – simple introduction and XML Schema RDF – basics, language RDF Schema –
Beginning XML 4th Edition. Chapter 5: XML Schemas.
1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006.
New Perspectives on XML, 2nd Edition
An OO schema language for XML SOX W3C Note 30 July 1999.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
XML – Part III. The Element … This type of element either has the element content or the mixed content (child element and data) The attributes of the.
1 Credits Prepared by: Rajendra P. Srivastava Ernst & Young Professor University of Kansas Sponsored by: Ernst & Young, LLP (August 2005) XBRL Module Part.
ACG 4401 XML Schemas XML Namespaces XLink. + The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context.
Sheet 1XML Technology in E-Commerce 2001Lecture 2 XML Technology in E-Commerce Lecture 2 Logical and Physical Structure, Validity, DTD, XML Schema.
Advanced Accounting Information Systems Day 31 XML Language Foundation November 6, 2009.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
XML Schema. Why Validate XML? XML documents can generally have any structure XML grammars define specific document structures Validation is the act of.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
XML Schema Definition (XSD). Definition of a Schema It is a model for describing the structure and content of data The XML Schema was developed as a content.
XML Validation II Advanced DTDs + Schemas Robin Burke ECT 360.
ACG 4401 XSLT Extensible Stylesheet Language for Transformations Presenting XML and XBRL.
 XML derives its strength from a variety of supporting technologies.  Structure and data types: When using XML to exchange data among clients, partners,
ACG 6415 XML Schemas XML Namespaces XMLink. The XML Foundation  Many participants – an extended family! XML documents – carry data in context  Each.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
Advanced Accounting Information Systems Day 34 XBRL Instance Documents and Taxonomies November 13, 2009.
ACG 6415 XBRL Instance Documents. XBRL Facts  Information Report  By a Specific Entity  Specific Period of Time  Specific Currency.
CITA 330 Section 4 XML Schema. XML Schema (XSD) An alternative industry standard for defining XML dialects More expressive than DTD Using XML syntax Promoting.
Web Services: Principles & Technology Slide 3.1 Chapter 3 Brief Overview of XML COMP 4302/6302.
Advanced Accounting Information Systems Day 28 Introduction to XBRL October 30, 2009.
MSc in Communication Sciences Program in Technologies for Human Communication Davide Eynard Facoltà di scienze della comunicazione Università.
XML Schema.
ACG 4401 XML Schemas XML Namespaces XLink.
XML QUESTIONS AND ANSWERS
CMP 051 XML Introduction Session IV
Lecture 9 XML & its applications
CWA3 Standardized roll-out package Part 2: XBRL Handbook for Declarers
2017, Fall Pusan National University Ki-Joune Li
Eugenia Fernandez IUPUI
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
XML Validation III Schemas
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
XML & UBL ACG 6415 Chapter 2.
ISSGC’05 XML Schemas (XSD)
ece 720 intelligent web: ontology and beyond
CMP 051 XML Introduction Session III
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
Optimising XML Schema for IODEF Data model
Lecture 9 XML & its applications
CMP 051 XML Introduction Session IV Chapter 12 – XML Namespaces
Semi-Structured data (XML)
XML Schema Diyar A. Abdulqder
New Perspectives on XML
Presentation transcript:

ACG 4401 XML Schemas XML Namespaces XLink

The XML Foundation Many participants – an extended family! XML Instance documents – carry data in context Each must be parsed into its component parts XML Schemas – define the rules a class of documents must follow Can be used to validate documents & contents XSLT – provide processing instructions Can be used to process XML documents Xlink (will discuss briefly, but its an important feature) Namespaces – qualify elements & attributes Differentiate & associate them with a URI

XML Schema Language Language (Vocabulary) used to create Schema Documents Schema Definition: “provide a means for defining the structure, content and semantics of XML documents.” (W3C) The Schema must be a Well-formed Document Defines structure and contents of Instance Document Similar to an ER-Diagram for databases Defines Each Element and Attribute Its Structure Includes Business Rules including: Cardinalities Used to Validate Instance Document Means Instance Document conforms to Schema Rules

XML Schema .xsd extension Defines each attribute and element But won’t open in IE so use .xml if using that browser Defines each attribute and element

Vocabularies & Schemas XBRL & UBL are vocabularies XBRL for Financial Reporting UBL for Business Documents Vocabularies are designed using Agreed upon element names Agreed upon element types Agreed upon element sequence/structure Defined by Schemas

Namespaces Each XML Vocabulary is associated with a unique NameSpace A unique identifier (think, primary key) Universal Resource Identifier (URI) Local Name (e.g. TeeTimeResevations.xml) URL (http://www……) Used to prevent naming collisions (more later)

Vocabularies and Namespaces A Unique Identifier Unique Prefix refers to URI Points to where information in an XML Document can be found. (URI) Attribute of Root Element Definition: “In XML, a namespace is a collection of names, identified by a URI reference, that are used in XML documents as element types and attribute names. In order for XML documents to be able to use elements and attributes that have the same name [tag name] but come from different sources, there must be a way to differentiate between the markup elements that come from the different sources.” (Webopeida) (Technical Information from W3.org) Used to preclude naming collisions Method for distinguishing between the same element name for different elements <inv:id>10001</inv:id> ... <employee:id>18897</employee:id>

How to Describe Elements in a Schema Element Types How to Describe Elements in a Schema

Types of Elements <Name>Bicycles Online, Inc.</Name> Simple contain only data (no attributes) <SalesOrderID>98765</SalesOrderID> Complex contain other elements (i.e. Root & Parent) <PartyName> <Name>Bicycles Online, Inc.</Name> </PartyName> contain attributes <PriceAmount currencyID="USD">730.55</PriceAmount>

Simple Element Definition Declare Name Declare Type <ID>abc12345</ID> <xs:element name=“ID” type=“xs:string”/> type= Defines the data type: string Integer date decimal other types

Complex Element (Parent) Declares Name Declares type Declares Structure <Instructor> <Name>Dr. Hornik</Name> </Instructor>

Complex Element (Parent) xml <xs:element name=”Instructor"> <xs:complexType> <xs:sequence> <xs:element name=“Name” type=“string”/> </xs:sequence> </xs:complexType> </xs:element>

Complex Element (attribute) Declare Name Declare Type Define element and attribute(s) For example: <cbc:PriceAmount currencyID="USD">730.55</cbc:PriceAmount>

Complex (Attribute) xml <xs:element name="PriceAmount"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:decimal"> <xs:attribute name="currencyID" type="xs:string” use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element>

Creating Schema from Instance Document PizzaOrders

Create a Schema from a non-vocabulary instance document Identify types of elements Simple Complex – Parent Complex – Attribute Create Prolog Create Root element Work down from 1st element to last

Root Element of Schema Document Root element is used to declare namespace(s) <xs:schema xmlns:xs=“http://www.w3.org/2001/XMLSchema”> xmlns:xs defines prefix to use for namespace xs: = namespace prefix “http:www.w3.org/2001/XMLSchema” location of Namespace, where the dictionary is Prefix is used before each tag xs:tagname

Identify Element Types PizzaOrder.xml

Schema Document Root Element

UBL Schemas Schemas for each document type Common Basic Components (all child elements) Defines all Child Elements: Defines Simple Elements Defines Complex (attribute) Elements Prefix: cbc (Namespace prefix) Common Aggregate Components Defines Complex (Parent) Elements Prefix: cac (Namespace prefix)

Creating UBL Document Schemas Declare NameSpaces and qualifiers Import necessary Schemas Define Root Element (from Instance Document) Reference Reusable data components Declare Cardinalities

Declaring a Namespace (in the UBL Instance document) <Invoice xmlns="UBLInvoiceDocument" xmlns:cbc="UBLCommonBasicComponents" xmlns:cac="UBLCommonAggregateComponents"> Default Namespace – a namespace without a prefix Since UBLInvoiceDocument does NOT have a prefix any element in the instance document without a prefix relates to this namespace. UBL Order Instance with namespaces

1. UBL Namespace Declaration in Root Element of Schema Document <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="UBLInvoiceDocument" xmlns:cbc="UBLCommonBasicComponents" xmlns:cac="UBLCommonAggregateComponents" elementFormDefault="qualified" attributeFormDefault="unqualified” targetNamespace="UBLInvoiceDocument">

Namespace Clarification targetNamespace="UBLInvoiceDocument“ The schema being created/used is applied to the UBLInvoiceDocument namespace elementFormDefault="qualified“ Element names will use a namespace prefix CAC: CBC: attributeFormDefault="unqualified“ Attribute names will not use a namespace prefix

2. UBL Import <xs:import namespace="UBLCommonBasicComponents" schemaLocation="http://www.skipwhite.com/ag2015/UBL CommonBasicComponentsSchema.xsd"/> <xs:import namespace="UBLCommonAggregateComponents" schemaLocation="http://www.skipwhite.com/ag2015/UBL CommonAggregateComponentsSchema.xsd"/>

3. UBL Root Element (Invoice.. Not complete) <xs:element name=”Invoice"> <xs:complexType> <xs:sequence> <xs:element ref="cbc:ID" minOccurs="1" maxOccurs="1"/> <xs:element ref="cbc:IssueDate" minOccurs="1" maxOccurs="1"/> <xs:element ref=“cbc:InvoiceTypeCode” minOccurs=“1” maxOccurs=“1”/> <xs:element ref=“cbc:Note” minOccurs=“0” maxOccurs=“unbounded”/> <xs:element ref=“cac:OrderReference” minOccurs=“1” maxOccurs=“1”/ <xs:element ref="cac:ProviderParty" minOccurs="1" maxOccurs="1"/> <xs:element ref="cac:ReceiverParty" minOccurs="1" maxOccurs="1"/> <xs:element ref="cac:InvoiceLine" minOccurs=”1” maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> Put it all together: The Entire Schema

UBL All UBL Instance documents are created using elements defined in Schemas (CBC or CAC). All UBL document schema’s define the content and structure of the UBL Instance document For any particular company A Companies rules related to an Order, Invoice, etc. UBL document are defined by their UBL Schema document It is a sub-set of the CAC and CBC

Validating XML Ensure that Instance Document Follows business rules Data types are correct Data is properly sequenced

Schemas and Vocabularies UBL Vs. XBRL

UBL Schema defines: Elements Attributes, and UBL Documents (i.e. Order, Invoice, DespatchAdvice, etc.)

XBRL Schema Defines: Elements Attributes Structure of XBRL documents Taxonomies Commercial and Industrial Banking and Savings IFRS Management Discussion and Analysis Report etc.

XLink

XML Linking Language Xlink Another XML foundation language Allows attributes of an element in an XML document to establish links with other documents/elements Simple: HTML type links (unidirectional/outbound) Extended: More complex Relationship links (multidirectional) describes relationships between elements

Simple links Unidirectional and always Outbound From element within Instance document to an outside resource Link to list of approved Vendors <InventoryItem xlink:type”simple” xlink:href=“http://ApprovedVendorList.xml”/>

Extended Links Attributes: xlink:type=“extended” Used in Parent element Indicates child elements will participate in the linking relationship Xlink:type=“locator” Remote resource In Child element Xlink:href=“http://….” In Child Element <OrderReconciliation xlink:type=“extended”> <Purchase id=“12345” xlink:type=“locator” xlink:href= http://PurchaseOrders.xml/> <Receiving id=“34567” xlink:type=“locator” xlink:href= http://ReceivingRpts.xml/> <Voucher id=“456789” xlink:type=“locator” xlink:href= http://Vouchers.xml/> </OrderReconciliation>