Unleashing the Killer App (Part 1)

advertisement
Current Issues in MIS
The XML Language Foundation
- 2007 f -
Clinton E. White, Jr
Professor of Accounting & MIS
Lerner College of B&E
University of Delaware
Skip 2007
Current Issues in MIS
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
• Can be used to validate documents & contents
– XSLT – provide processing instructions
• Can be used to process XML documents
– Namespaces – qualify elements & attributes
• Differentiate & associate them with a URI
– XPath … XLink … XQuery …
• XML Processors are not designed equally!
Skip 2007
Current Issues in MIS
Simple Elements
• Simple XML elements can contain only
data values
– In an XML document:
• <Name>Basketball</Name>
– In an XML schema:
• <xs:element name=“Name” type=“xs:string”/>
Skip 2007
Current Issues in MIS
Complex Elements
• Complex XML elements contain other
elements nested within them and/or contain
attributes
– In an XML document
• <InventoryItem idNumber=“12345”>
•
<Name>Basketball</Name>
•
<Cost units="USD">12.50</Cost>
•
<RetailPrice units="USD">25.00</RetailPrice>
•
</InventoryItem>
Skip 2007
Current Issues in MIS
Complex Elements
• In an XML schema:
• <xs:element name="InventoryItem" minOccurs="1"
•
maxOccurs="unbounded">
•
<xs:complexType>
•
<xs:sequence>
•
<xs:element name="Name" type="xs:string"/>
•
<xs:element name="Cost" type="monetary"/>
•
<xs:element name="RetailPrice" type="monetary"/>
•
</xs:sequence>
•
<xs:attribute name=“idNumber” type=“xs:integer”/>
•
</xs:complexType>
•
</xs:element>
Skip 2007
Current Issues in MIS
Simple Element with an Attribute
(complex element)
• A simple element with an attribute is a complex
element (but with simple content)
– In an XML document
• <Description brand=“Rollins">Regulation NBA</Description>
– In an XML schema
• <xs:element name=“Description“>
• <xs:complexType>
• <xs:simpleContent>
•
<xs:extension base=“xs:string">
•
<xs:attribute name=“brand" type="xs:string"/>
•
</xs:extension>
•
</xs:simpleContent>
•
</xs:complexType>
•
</xs:element>
Skip 2007
Current Issues in MIS
Skip 2007
Current Issues in MIS
Validation
XML
Document
XML
schema
document
Validating
XML
Processor
Validated
XML
Document
• Validated & ready
for further
processing
Skip 2007
Current Issues in MIS
XML Namespaces
(xmlns)
• XML Namespaces:
– A collection of elements and attributes for
a particular purpose
• Each XML namespace has a unique URI
• Each namespace is declared using “xmlns”
– xmlns:xs="http://www.w3.org/2001/XMLSchema“
– xmlns:us-gaap-ci ="http://www.xbrl.org/us/fr/gaap/
ci/2005-02-28/us-gaap-ci%20Summary%20Page.htm“
• Each namespace has its own recommended
prefix
Skip 2007
Current Issues in MIS
Namespaces
• Namespaces solve the naming
collision problem!
– What if within your company, you have
an accounting department & a shipping
department and they each want to use the
XML element name “status” to mean
things uniquely relevant to them?
• In accounting, status is used to mean billed or
not!
• In shipping, status is used to mean shipped or
not!
Skip 2007
Current Issues in MIS
Namespaces
• The solution
– Create a separate namespace for each
department & within each namespace,
define the element name “status”
• Accounting’s namespace:
– xmlns:acct=“myCompany.com/xml/accounting”
• Shipping’s namespace:
– xmlns:ship=“myCompany.com/xml/shipping”
Skip 2007
Current Issues in MIS
Namespaces
• Within the myCompany.com/xml/accounting namespace
• <xs:element name=“Status”>
•
<xs:simpleType>
•
<xs:restriction base= “xs:string”>
•
<xs:enumeration value=“not billed”/>
•
<xs:enumeration value=“billed”/>
•
</xs:restriction>
•
</xs:simpleType>
• Within the myCompany.com/xml/shipping namespace
• <xs:element name=“Status”>
•
<xs:simpleType>
•
<xs:restriction base= “xs:string”>
•
<xs:enumeration value=“not shipped”/>
•
<xs:enumeration value=“shipped”/>
•
</xs:restriction>
•
</xs:simpleType>
Skip 2007
Current Issues in MIS
Sales Order Status Report
• <?xml version="1.0"?>
• <SalesOrderStatus
• xmlns:ship="http:myCompany.com/xml/shipping"
• xmlns:acct="http:myCompany.com/xml/accounting">
•
<SalesOrder>
•
<OrderNumber>123456</OrderNumber>
•
<OrderDate>2005-07-10</OrderDate>
•
<ship:Status>shipped</ship:Status>
•
<acct:Status>not billed</acct:Status>
•
</SalesOrder>
• </SalesOrderStatus>
Skip 2007
Current Issues in MIS
XLink
• XLink – the XML linking language
– An “attribute” language to be used in
XML documents to define explicit
relationships between resources
– XLink attributes can be used on any XML
element
– XLink attributes are used to describe both
“simple” and “extended” relationships
Skip 2007
Current Issues in MIS
A Simple Link
• What if you wanted to define a link between
an InventoryItem and an approved list of
vendors?
– <Inventory xmlns:xlink=“http://www.w3.org/1999/xlink”>
• <InventoryItem xlink:type=“simple”
xlink:href=“ApprovedVendorsList.xml”>
– A “simple” XLink creates a unidirectional link
between an element and the document (resource)
found at the referenced URI
Skip 2007
Current Issues in MIS
An Extended Link
• What if you wanted to create a report to be used to
reconcile a PO, receiving report, and voucher from a
vendor?
– <OrderReconciliationReport
xmlns:xlink=“http://www.w3.org/1999/xlink”>
– <OrderReconciliation id=“98765” xlink:type=“extended”>
–
<PurchaseOrder id=“12345” xlink:type=“locator”
–
xlink:href= “http://PurchaseOrders.xml”/>
–
<ReceivingReport id=“34567” xlink:type=“locator”
–
xlink:href= “http://ReceivingRpts.xml”/>
–
<Voucher id=“456789” xlink:type=“locator”
–
xlink:href= “http://Vouchers.xml”/>
– </OrderReconciliation>
– Extended links are used to create more complex
relationships between resources
• As in financial statements!
Skip 2007
Current Issues in MIS
XBRL
• XLink is used in the XBRL vocabulary
to create “linkbases”
– XBRL linkbases are databases of extended
links to define accounting concepts and
their relationships
• How is “current assets” calculated?
• How is it presented on a balance sheet?
• What official references apply?
Skip 2007
Current Issues in MIS
Assignment
• Assignment due: 10/4/2007
– Exercise 3-1
Skip 2007
Download