1 / 16

XML Schema Lecture - 2013S -

XML Schema Lecture - 2013S -. Clinton E. White, Jr Professor of Accounting & MIS Lerner College of B&E University of Delaware. The XML Foundation. Many participants – an extended family! XML documents – carry data in context Each must be parsed into its component parts

belle
Download Presentation

XML Schema Lecture - 2013S -

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Schema Lecture- 2013S - Clinton E. White, Jr Professor of Accounting & MIS Lerner College of B&E University of Delaware

  2. The XML Foundation • Many participants – an extended family! • XML documents – carry data in context • Each must be parsed into its component parts • XML schemas – define the rules a class of documents must follow • Are used to define vocabularies and validate documents & their contents • XSLT – provide processing instructions • Is used to process XML documents • Namespaces – qualify elements & attributes • Differentiate & associate them with a URI • XPath … XLink … XQuery … • Warning: XML Processors are not designed equally!

  3. UBL & XML schema Namespaces • <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cbc="UBLCommonBasicComponents" xmlns:cac="UBLCommonAggregateComponents" xmlns=“UBLOrderDocument” targetNamespace="UBLOrderDocument"> • Also: elementFormDefault="qualified" attributeFormDefault="unqualified“

  4. Namespaces(xmlns) • XML Namespaces: • A collection of elements and attributes for a particular purpose • Each XML namespace has a unique URI that differentiates it from all others • Each namespace is declared using “xmlns” • xmlns:xs="http://www.w3.org/2001/XMLSchema“ • xmlns:cbc="UBLCommonBasicComponents" • xmlns:cac="UBLCommonAggregateComponents“ • xmlns:us-gaap="http://xbrl.fasb.org/us-gaap/2012" • xmlns:ifrs="http://xbrl.ifrs.org/taxonomy/2012-03-29/ifrs" • Each namespace has its own recommendedprefix

  5. UBL • UBL schemas: • All UBL reusable components and the common documents that are created using them are defined in XML schemas • The UBL schemas are the contents of the UBL library • We simply reference the elements and use them in our XML instance documents • UBL Invoice example

  6. E-business Procurement(e-business document exchanges)

  7. XML Schema • XML Schema • A language used to create XML schema documents • XML schema documents define elements & attributes for a specific purpose and the rules that a class of XML documents must follow • Define each element and each attribute that can appear in a document by giving each a name and a data type • Define the structure of the document • Define simple business rules

  8. UBL cbc schema • Defines all of the simple elements in the UBL vocabulary: • <?xml version="1.0" encoding="UTF-8" ?> • <!-- File: UBLCommonBasicComponentsSchema.xml   --> • <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="UBLCommonBasicComponents" targetNamespace="UBLCommonBasicComponents" elementFormDefault="qualified" attributeFormDefault="unqualified"> • - <!-- Simple elements   --> • <xs:element name="ID" type="xs:string" /> • <xs:element name="Name" type="xs:string" /> • <xs:element name="SalesOrderID" type="xs:string" /> • <xs:elementname="IssueDate" type="xs:date" /> • … …

  9. UBL cac schema • The UBL Common Aggregate Components schema: • Imports the UBL Common Basic Components schema • Defines all complex UBL elements • <xs:element name="Party"> • <xs:complexType> • <xs:sequence> • <xs:element ref="PartyName" minOccurs="1" maxOccurs="1" /> • <xs:element ref="PostalAddress" minOccurs="1" maxOccurs="1" /> • <xs:element ref="Contact" minOccurs="0" maxOccurs=“unbounded" /> • </xs:sequence> • </xs:complexType> • </xs:element> • All complex UBL elements are defined in a schema by giving them a unique name, a complexType, and defining their contents (i.e., other complex or simple elements)

  10. Schemas • XMLNS - in root element: • xmlns:cbc="UBLCommonBasicComponents“ • xmlns:cac="UBLCommonAggregateComponents“ • Import namespaces in schema document & tie them to a schemaLocation: • <xs:importnamespace="UBLCommonBasicComponents" schemaLocation="http://www.buec.udel.edu/whitec/UBLCommonBasicComponents/UBLCommonBasicComponentsSchema.xsd"/> • <xs:importnamespace="UBLCommonAggregateComponents" schemaLocation="http://www.buec.udel.edu/whitec/UBLCommonAggregateComponents/UBLCommonAggreagteComponentsSchema.xsd"/> • Usecbcandcacnamespaceprefixeswhereappropriate in the schema document

  11. Well-formed vs. Valid • What is the difference between a Well-formed and a Valid XML document?

  12. Valid XML Documents XML document Valid XML document XML Validating Processor XML schema document Imported XML schema documents

  13. Schema Validator • Does the XML document follow the rules specified in its schema? • http://tools.decisionsoft.com/schemaValidate/Validate • Warning: • Not all validators are created equal!

  14. Financial Reporting • A business entity: • Creates its financial reports in XBRL format • Uses elements defined in the U.S. GAAP XBRL taxonomy schemas • Uses elements defined in its own extension taxonomy schemas • Validates the XBRL instance documents • Submits both the taxonomy schemas & the instance documents to the SEC as a “package” • The SEC • Validates the instance documents • Files both the XBRL instance docs. & the taxonomy schemas in the EDGAR (formerly IDEA) database

  15. XBRL Instance Documents • Well-formed and valid XBRL instance documents: • xbrl – the root element • schemaRef – the first child element • context – must have at least one • unit – must have at least one if numeric items are being reported • item – must have at least one reported item

  16. Assignment(Due 3/22/2013) • Exercise 3-2 • A UBL Invoice document schema • Include your name in a comment at the top of the document • <!--your name--> • Validate your UBL Invoice document against your UBL Invoice schema

More Related