Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Extensible Markup Language. Today: Imagine Cup –Wednesday, February 2nd from 6-8 pm in Lally Hall, Room 104, we will have a representative on campus.

Similar presentations


Presentation on theme: "XML Extensible Markup Language. Today: Imagine Cup –Wednesday, February 2nd from 6-8 pm in Lally Hall, Room 104, we will have a representative on campus."— Presentation transcript:

1 XML Extensible Markup Language

2 Today: Imagine Cup –Wednesday, February 2nd from 6-8 pm in Lally Hall, Room 104, we will have a representative on campus for the Imagine Cup Program. Pizza and soda will be provided. Homework #1 XML In class: define your class schedule in XML (groups ~10) Tuesday: XSLT (reformatting XML)

3 Standards Help or hinder innovation? Think about it

4 Standards http://www.w3.org/ –HTML, CSS, XML, XPATH, SVG, Services, Semantic Web http://www.iana.org/ –URNs, DNS, IP Addresses http://www.ietf.org/ –HTTP, TCP/IP http://www.ieee.org/ –Ethernet, 802.1-, MAC addresses

5 Standards NTSC –1936, industry recommendation –1941, B&W standard –1950, color standard –2009, FCC required shutdown of NTSC broadcast

6 Standards Standards in Physical Infrastructure –European vs. US cell phone technology adoption rates (one euro standard v. 3 in the US) –Gas Stations & alternate fuels for personal transportation

7 Standards Help or hinder innovation? Ok, lets have a discussion

8 XML Organize Data –Consistent Syntax –Semantic Free

9 Stuff we do with XML machine to machine transfer of models & data data storage (best for storing data in a tree format) sending data from the application to the presentation layer

10 KML / AJAX Example Google maps consumes KML Outputs JS / XHTML / CSS Structured data can be reused.

11

12

13 An Example XML Doc

14 Some Common XML types Atom –Which is really cool because it can hold other formats within it RSS Itunes Library KML XHTML…

15 XHTML A specific flavor of XML Defined by a DTD (Document Type Definition) –http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd

16 XML documents must be: Well-formed –Adhere to XML syntax rules Valid –Adhere to the rules in the specified DTD

17 Root / Parents Elements must have a parent Documents must have one document root is the only top level element. It is the document root

18 XML Syntax Rules Elements must have a closing tag: –... – Self closing tags

19 Proper Nesting of Elements: blah  blah 

20 Element Naming Rules Elements are lowercase only Elements must not start with “xml” Element names should not contain “-” or “:”

21 Attributes Elements describe data Attributes describe elements Attributes must be in quotes Examples

22 Namespaces Used to prevent element or attribute name or ‘meaning’ collisions Example  Namespace collision  Two namespaces namespace nameelement name

23 Namespaces Pointing to a namespace xmlns attribute In –an element –global definition

24 Namespaces In an element (applies to all of its children)

25 Namespaces Global <html xmlns:h=“http://www.w3.org/1999/xhtml” xmlns:m="http://www.w3.org/1998/Math/MathML" >.. Some text

26 Namespaces + Standards Decisions are expensive Use a preexisting format (no limit to number of namespaces on a page) http://www.dublincore.org/documents/dc- xml-guidelines/http://www.dublincore.org/documents/dc- xml-guidelines/

27 DTD Document Type Definition Internal or external file describing list of elements, attributes and their relationships. Machine readable

28 DTD Building Blocks Elements (describe data) Attributes (describe elements) PCDATA (the stuff between tags that gets parsed) CDATA - (data between tags that contains other data that you do not want parsed) Entities - (special items, such as & )

29 DTD Elements Defining an element element name type

30 DTD Elements Defining an empty element (no closing tag) Defining an element with children

31 DTD Attributes Setting a default setting the default colspan value to 1 in a element

32 DTD Attributes required attribute & implied attribute XML author must include a value for page to validate author does not have to include attribute/value and we aren't setting a default either

33 DTD & Standards Load: http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd Look at line 273 What are the first children elements allowed inside

34 DTD & Standards http://validator.w3.org/ Validator compares rules in the DTD with the XML implemented.

35 DTD Entities Exist in XML like this & + name + ; lt, jt, amp, apos, quot are supported by defualt DTD author can specify custom entities to operate as replacement variables –Example: &myname; –(replacement defined in the DTD)

36 XHTML Entities http://www.w3schools.com/tags/ref_entitie s.asphttp://www.w3schools.com/tags/ref_entitie s.asp 5 ‘Reserved Characters’ must not be part of your page content … use HTML entities instead

37 Entities  JS or XSLT –Watch less than / greater than Input you don’t control –Watch everything!! Wrap data in CDATA

38 Entities  Wrap data in CDATA (will not be parsed)

39 Entities  hi ]]> Would display as hi

40 Entities  <?PHP $good = htmlentities ($bad); ?>


Download ppt "XML Extensible Markup Language. Today: Imagine Cup –Wednesday, February 2nd from 6-8 pm in Lally Hall, Room 104, we will have a representative on campus."

Similar presentations


Ads by Google