23
1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

Embed Size (px)

Citation preview

Page 1: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

1

XMLAn Overview

Roger DebrecenyUniversity of Hawai`i

Skip WhiteUniversity of Delaware

XBRL Workshop, August 2006

Page 2: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

2

XMLThe eXtensible Markup Language

Page 3: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

3

Markup languages

What is a markup language? Markup languages “markup” text (data) so

that one string of text can be distinguished from another!

What does the following mean? 141 68 7.5

Page 4: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

4

XML

Markup language Could be anything – space, comma, tab , … Need agreement on the markup!

eXtensible Able to “extend” Need agreement on the markup rules!

<weight> 141 </weight> <height> 68 </height> <shoeSize> 7.5 </shoeSize>

Page 5: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

5

HTML

HyperText Markup Language An agreed-on language for creating Web pages A fixed set of tags as markup

<head> <title> My Web Page </title> </head> <body> <center> Hello – Welcome to my Web page!

</center> </body>

Tells a browser how to display things!

Page 6: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

6

XML - markup for documents

The markup rules & syntax that all “well-formed” XML documents must follow: One and only one root element All elements must be properly nested All non-empty elements must have the same

beginning and ending tag names (case-sensitive)

Elements can contain data items or other elements (mixed is considered bad form)

All elements can contain attributes

Page 7: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

7

XML Elements

The basic unit of all XML documents is the “element” A root element

Is the master element … the overall “container” Its name tells what the document is all about

Simple elements contain data values and do not have attributes <IdNumber> 12345 </IdNumber>

Complex elements have attributes and/or other elements nested within <Weight units=“OZS”>12.00</Weight> <InventoryItem>

<IdNumber>12345</IdNumber> <Weight units=“OZS”>12.00</Weight> </InventoryItem>

Page 8: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

8

XML document (part 1) <SalesOrder>

<CustomerInformation> <CustomerNumber>12345</CustomerNumber> <Address type=“shipping” sameAs=“billing”>

<FirstName>Skip</FirstName> <LastName>White</LastName> <StreetAddress1> 1234 Main Street

</StreetAddress1> <StreetAddress2></StreetAddress2> <City> Newark </City> <State> DE </State> <ZipCode> 19716 </ZipCode> <Country> USA </Country> </Address>

<Address type=“billing” sameAs=“shipping”/> </CustomerInformation>

Page 9: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

9

XML document (part 2) <OrderInformation>

<OrderNumber>111</OrderNumber> <OrderDate>2006-08-02</OrderDate> <CreditCard type="VISA"> <CardHolderName> Skip

White</CardHolderName> <CardNumber>

1234567891011213</CardNumber> <ExpirationDate>

2009-05</ExpirationDate> </CreditCard> <Item> <ItemId>srh123</ItemId> <ItemDescription> Specialized RH

Mountain Bike </ItemDescription> <Size units="in">19</Size> <QuantityOrdered> 1</QuantityOrdered> <SalePrice units="USD">

550.00</SalePrice> </Item> </OrderInformation>

Page 10: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

10

XML documents What can we say about XML documents?

XML documents are made up of tags (markup) that add meaning/context to data items A pair or tags and its content is known as an element

XML elements can contain attributes within the beginning tag – attributes add meaning! The XML attribute format is: attributeName=“value”

XML documents are structured in a strict hierarchy

Well-formed XML documents can be processed by an XML processor

Page 11: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

11

XML Documents

Why are XML documents so popular for storing and transforming information on networks? Easy to create & understand Contain data with meaning & context

Processing data as information Very efficient for computers to process A standardized and non-proprietary

language

Page 12: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

12

XML Fundamentals

XML documents are hierarchical Structured as tree-like hierarchies

XML documents are self-describing Each piece of data (information) has

descriptive information associated with it XML is directly usable over the Internet

Designed for storing & delivering information XML does not currently replace HTML

XML describes the content while in most cases HTML is used to tell a browser how to display it

Page 13: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

13

Information in XML Documents

So … What do you have when you have information in XML documents? You have information that can be

understood by humans as well as ANY COMPUTER APPLICATION!!!

XML is being referred to as the Rosetta Stone of networked computing! The transfer of information between computer

applications and between computers and humans will become much more intelligible and automatic

Page 14: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

14

XML specifications

XML is a set of rules and syntax for creating XML documents and specifications (stds.) that extend the capabilities of XML XML documents are used to store and transfer

structured data over computer networks XML specifications extend the basic rules of XML

to create languages & vocabularies to be used to: Define the contents & structure of XML documents Process XML documents Create languages to support XML document processing

Page 15: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

15

XML Specifications XML Schema language

To define the allowable contents & structure of XML documents & to create additional XML specs.

XML Namespaces (xmlns) A collection of element names & attributes for

a particular purpose - like business reporting & they help to avoid naming collisions!

XML Linking Language (XLink) Attributes to be used to define sophisticated

links between networked resources XBRL – a special purpose XML vocabulary!

Page 16: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

16

XML namespaces

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!

Page 17: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

17

XML namespaces

The solution Create a separate namespace for each

department & within each namespace, define the element name “status”

myCompany.com/xml/accounting Preferred namespace prefix: acct <status> billed (notBilled) </status>

myCompany.com/xml/shipping Preferred namespace prefix: ship <status> shipped (notShipped) </status>

Page 18: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

18

XML namespaces in XML docs.(a sales order status report) <SalesOrderStatus xmlns:acct=“http://myCompany.com/xml/accounting” xmlns:ship=“http://myCompany.com/xml/shipping”>

<OrderNumber> 12345 </OrderNumber> <OrderDate> 2006-08-02</OrderDate> <ship:Status> shipped </ship:Status> <acct:Status> notBilled </acct:Status> </SalesOrderStatus>

Page 19: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

19

XML Namespaces

XML namespaces Contain a collection of elements & attributes for a

particular purpose In XML documents:

Namespaces must be declared using the xmlns attribute (usually declared in the root element) xmlns:prefix=“http: namespace URI”

After declaration, a namespace prefix can be appended to an element or an attribute – designates that it was defined in a particular namespace (for a particular purpose) <us-gaap-ci:CurrentAssets>10000</us-gaap-

ci:CurrentAssets>

Page 20: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

20

XLink language

The XML XLink language A link is an explicit relationship between any

addressable resources – information or services The XLink specification defines a set of

attributes that can be used with any XML element to create explicit relationships

Simple links (commonly seen on Web pages) are unidirectional from a source to a target doc.

Extended links are two-way and multidirectional and can describe relationships

Page 21: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

21

Xlink language XLink is used heavily in the XBRL

specification (& in XBRL documents) To link a taxonomy to an XBRL instance

document <link:schemaRef xlink:type=“simple”

xlink:href=“us-gaap-ci-2005-02-28.xsd”/> <us-gaap-ci:CurrentAssets>10000</us-gaap-

ci:CurrentAssets> To define relationships between facts

reported in an XBRL instance document To create “linkbases” to provide additional

information about accounting concepts in instance documents

Page 22: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

22

Summary – Introduction to XML

XML is a set of rules and syntax for creating XML documents and specifications (stds.) that extend the capabilities of XML XML documents are used to hold and transfer

structured data over computer networks XML specifications extend the basic rules of

XML to create languages & vocabularies XML Namespaces XML XLink language XML Schema language XBRL – a special purpose XML vocabulary

Page 23: 1 XML An Overview Roger Debreceny University of Hawai`i Skip White University of Delaware XBRL Workshop, August 2006

23

Reference material

W3C Schools – XML tutorial: http://www.w3schools.com/xml/default.asp

W3C Schools – HTML tutorial: http://www.w3schools.com/html/default.asp

HTMLHelp.com – HTML references & tutorials: http://www.htmlhelp.com/