Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake.

Similar presentations


Presentation on theme: "1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake."— Presentation transcript:

1 1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake

2 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 2 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

3 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 3 What is XML? XML stands for eXtensible Markup Language. XML is a system for defining, validating, and sharing document formats. Standard organization: World Wide Web Consortium (W3C): http://www.w3.org/XML/.http://www.w3.org/XML/

4 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 4 XML Basic Constructs XML uses tag elements and attributes to describe document structures and properties. Unlike HTML, XML is extensible. Authors can use XML to define a new language for a given application. XML is a meta-language.

5 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 5 A Simple XML Example Bun Yue Everybody Hello, welcome! XML Version must be in the first line. XML contents Root element

6 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 6 Why XML? XML captures semantic well. Simple. Text. Standard. Wide support. Validation. Abundance of tools.

7 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 7 Some Disadvantages Verbose Text Ordered tree model may not fit best

8 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 8 Some UHCL XML Applications Web Services: SOAP, UDDI, WSDL, etc. XHTML VoiceXML

9 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 9 Some UHCL XML Applications Wireless Markup Language (WML)

10 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 10 Some UHCL XML Applications Scalar Vector Graphics (SVG) A triangle fractal

11 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 11 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

12 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 12 XML Modeling Devise an XML vocabulary to capture an application. May use available modeling tools and languages, such as UML. XML basically uses an ordered tree model.

13 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 13 XML Tree Model XML file: Hi There Bye Document Root aProlog cbb An XML tree showing element nodes only

14 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 14 Syntax & Validation All XML document must be well-formed: satisfying basic syntax. XML documents may be validated by various schemas. Validation: –Cost: time and effort. –Benefit: increased reliability.

15 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 15 XML Validation Languages –Document Type Definition (DTD) –XML Schema –Schematron –Relax NG

16 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 16 Document Type Definition (DTD) A grammar to determine the validity of an XML document. An XML document satisfying the rules of a DTD is said to be validated. DTD is part of the XML language standard.

17 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 17 A Simple DTD <!ATTLIST person id ID #REQUIRED spouse IDREF #IMPLIED>

18 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 18 DTD Validation An XML document validated by the DTD: Adam Eva John

19 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 19 Not Validated Eva Adam John Jack

20 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 20 Limitations of DTD Schema languages have limited expressive power. DTD is simple and not expressive. Others are more expressive (and complicated): e.g. XML Schema.

21 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 21 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

22 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 22 XML Parsing A large collection of XML Parsers in various languages: Java, Perl, C#,… Two popular classes: –DOM (Document Object Model): Build an XML tree. –SAX (Simple API for XML): Event driven (push).

23 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 23 SAX XML Input is converted to a sequence of events (e.g. startElement, endElement, characters, …) Programmers define event handlers to handle the events.

24 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 24 SAX Example // Java public void startElement(String namespaceURI, String lName, // local name String qName, // qualified name Attributes attrs) throws SAXException { numElements++; // numElements is a data member. } // startElement

25 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 25 DOM DOM (Document Object Model): a W3C standard. A “platform- and language-neutral interface” to present documents. DOM parser parses an XML document and build an XML tree. DOM classes can then be used to access and manipulate the tree.

26 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 26 DOM Example try { // Java // Parse input XML file. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance() DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(new File(argv[0])); System.out.println(“Name of root element of " + argv[0] + " = " + document.getDocumentElement().getLocalName())) } …

27 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 27 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

28 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 28 XML Transformation Transformation from XML to XML and other formats. Can use XML parsers. XSLT: XML Stylesheet Language/Transform.

29 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 29 XSLT Rule-based language for XML transformation. Contains a set of templates (rules) for identifying components to be acted on.

30 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 30 XSLT Template

31 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 31 XSLT Example An XSLT template to replace an element by, preserving its content:

32 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 32 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

33 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 33 Storage of XML XML can be stored as files or in database. Leading databases support XML storage: –Native XML Database –XML Enhanced Database

34 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 34 XQuery W3C Standard For effectively querying and retrieving information from a diversified XML sources. Similar to SQL for relational database.

35 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 35 XQuery Example {for $f in doc(“diagrams.xml")//figure return { $f/title } }

36 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 36 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

37 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 37 XML Related Courses CSCI 4230 Internet Application Development: started covering XML in Spring 2000. –Example project: using MS XML parser, parse XML weather information from an external site, retrieve its information, and present it in a specific HTML format.

38 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 38 XML Related Courses CSCI 5733 XML Application Development: started in Spring 2002. Complete coverage of details of this presentation + much more. Programming assignments in XML parsers, XSLT, XPath, WML, SVG, etc.

39 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 39 Capstone Projects Graduate capstone projects from external companies. Some XML project examples: –SVG –XML difference engine –XML based workflow

40 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 40 XML Research at UHCL Some examples: –Effective storage of XML in relational database. –Mapping of DTD to relational schema. –Software metrics for XML Schema.

41 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 41 Content What is XML? XML Modeling XML Parsing XML Transformation XML and Databases XML at UHCL Conclusions

42 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 42 Conclusions XML: wide potential for applications and research. UHCL is an early adopter. Many UCHL students are trained in XML.

43 9/10/2005Bun Yue: yue@cl.uh.edu, http://dcm.uhcl.edu/yueslide 43 Questions? Any Questions? Thanks!


Download ppt "1 XML at a neighborhood university near you Innovation 2005 September 16, 2005 Kwok-Bun Yue University of Houston-Clear Lake."

Similar presentations


Ads by Google