acg 4401 n.
Skip this Video
Download Presentation
ACG 4401

Loading in 2 Seconds...

play fullscreen
1 / 33

ACG 4401 - PowerPoint PPT Presentation

  • Uploaded on

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

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'ACG 4401' - varden

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
acg 4401
ACG 4401

XML Schemas

XML Namespaces


the xml foundation
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
XML Schema Language
  • Language (Vocabulary) used to create Schema Documents
  • Schema
    • Used to define the structure and content of Instance documents
  • Well-formed XML document
    • Definition: “provide a means for defining the structure, content and

semantics of XML documents.” (W3C)

  • Defines structure and contents of Instance Document
    • Similar to an ER-Diagram for databases
    • Defines Each Element and Attribute
    • Its Structure
  • Includes Business Rules
    • Cardinalities
  • Used to Validate Instance Document
    • Means Instance Document conforms to Schema Rules
xml schema
XML Schema
  • .xsdextension
    • But won’t open in IE so use .xml if using that browser
  • Defines each attribute and element
vocabularies schemas
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
  • 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
Vocabularies and Namespaces
  • Namespace
    • 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
  • 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>
element types

Element Types

How to Describe Elements in a Schema

types of elements
Types of Elements
  • Simple
    • contain only data


  • Complex
    • contain other elements (i.e. Root & Parent)


<Name>Bicycles Online, Inc.</Name>


    • contain attributes


simple element definition
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
Complex Element (Parent)
  • Declares Name
  • Declares type
  • Declares Structure


<Name>Dr. Hornik</Name>


complex element parent xml
Complex Element (Parent) xml

<xs:element name=”Instructor">



<xs:element name=“Name” type=“string”/>




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

<xs:element name="PriceAmount">



<xs:extension base="xs:decimal">

<xs:attribute name="currencyID" type="xs:string” use="required"/>





create a schema from a non vocabulary instance document
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 of Schema Document
  • Root element is used to declare namespace(s)
    • <xs:schemaxmlns:xs=“”>
      • xs: = namespace prefix
      • xmlns:xs defines prefix to use for namespace
      • “” location of Namespace, where the dictionary is
      • Prefix is used before each tag xs:tagname
ubl schemas
UBL Schemas
  • Schemas for each document type
  • Common Basic Components (allchild 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
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
Declaring a Namespace (in the UBLInstancedocument)

<Catalogue xmlns="UBLCatalogueDocument"



  • Since UBLCatalogueDocument does NOT have a prefix any element in the instance document without a prefix relates to this namespace.
  • UBL Catalogue Instance with namespaces
1 ubl namespace declaration in root element of schema document
1. UBL Namespace Declaration in Root Element of Schema Document

<?xml version="1.0" encoding="UTF-8"?>








namespace clarification
Namespace Clarification
  • targetNamespace="UBLCatalogueDocument“
    • The schema being created/used is applied to the UBLCatalogueDocument 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
2. UBL Import





3 ubl root element catalogue
3. UBL Root Element (Catalogue)

<xs:element name="Catalogue">



<xs:elementref="cbc:ID" minOccurs="1" maxOccurs="1"/>

<xs:element ref="cbc:Name" minOccurs="1" maxOccurs="1"/>

<xs:element ref="cbc:IssueDate" 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:CatalogueLine" minOccurs=”1” maxOccurs="unbounded"/>




Put it all together: The Entire Schema

validating xml
Validating XML
  • Ensure that Instance Document
    • Follows business rules
    • Data types are correct
    • Data is properly sequenced
  • Schema defines:
    • Elements
    • Attributes, and
    • UBL Documents (i.e. Order, Invoice, DespatchAdvice, etc.)
  • Schema Defines:
    • Elements
    • Attributes
    • Structure of XBRL documents
    • Taxonomies
      • Commercial and Industrial
      • Banking and Savings
      • IFRS
      • Management Discussion and Analysis Report
      • etc.
xml linking language
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)
simple links
Simple links
  • Unidirectional and always Outbound
    • From element within Instance document to an outside resource
  • Link to list of approved Vendor

<InventoryItemxlink:type”simple” xlink:href=“http://….”/>

extended links
Extended Links
  • Attributes:
    • xlink:type=“extended”
      • Used in Parent element
    • Xlink:type=“locator”
      • Remote resource
      • In Child element
    • Xlink:href=“http://….”
      • In Child Element

<Orders 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/>