Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICE0534 – Web-based Software Development ICE1338 – Programming for WWW Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information.

Similar presentations


Presentation on theme: "ICE0534 – Web-based Software Development ICE1338 – Programming for WWW Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information."— Presentation transcript:

1 ICE0534 – Web-based Software Development ICE1338 – Programming for WWW Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University (ICU) - Summer 2005 -

2 Summer 2005 2 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Announcements Links to your homepages have been added to the class Web site Links to your homepages have been added to the class Web site Term-project proposals are due by today Term-project proposals are due by today Ph.D. lecture proposals are due by today Ph.D. lecture proposals are due by today

3 Summer 2005 3 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Last Lecture Plug-ins and Multimedia Presentations Plug-ins and Multimedia Presentations Java Applets & Java Plug-in Java Applets & Java Plug-in Communication between Applets and Web documents Communication between Applets and Web documents SVG (Scalable Vector Graphics) SVG (Scalable Vector Graphics) Technology Review Technology Review X3D X3D Technology Survey Technology Survey Plug-in Software Plug-in Software

4 Summer 2005 4 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University This Lecture XML and XML processing XML and XML processing Technology Reviews Technology Reviews XSL [u5: Hogun Park] XSL [u5: Hogun Park] Technology Surveys Technology Surveys XML query languages [g7: Changki Kim] XML query languages [g7: Changki Kim] XML Schema [g8: Heewon Lee] XML Schema [g8: Heewon Lee] Other XML-based languages [g9: Jeongwook Bang] Other XML-based languages [g9: Jeongwook Bang]

5 Summer 2005 5 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Student Homepages

6 Summer 2005 6 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Limitations of HTML Fixed set of tags and attributes Fixed set of tags and attributes User cannot define new tags or attributes User cannot define new tags or attributes Static tag semantics Static tag semantics Tags cannot connote any particular meaning Tags cannot connote any particular meaning No restrictions on arrangement or order of tag appearance No restrictions on arrangement or order of tag appearance AW lecture notes, XML.com Cannot be used as a markup language for structured information that contains: Content – e.g., text, picturesContent – e.g., text, pictures Semantics (Roles) of ContentSemantics (Roles) of Content

7 Summer 2005 7 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University SGML (Standard Generalized Markup Language) SGML is a meta-markup language developed in the early 1980s (ISO 8879, 1986) SGML is a meta-markup language developed in the early 1980s (ISO 8879, 1986)ISO 8879ISO 8879 Descendant of IBM's Generalized Markup Language (GML), developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond Lorie [Wikipedia] Descendant of IBM's Generalized Markup Language (GML), developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond Lorie [Wikipedia] HTML was developed using SGML in the early 1990s - specifically for Web documents HTML was developed using SGML in the early 1990s - specifically for Web documents SGML is too large and complex to use, and it is very difficult to build a parser for it SGML is too large and complex to use, and it is very difficult to build a parser for it AW lecture notes

8 Summer 2005 8 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML (Extended Markup Language) XML is a light version of SGML that provides a way of storing and transferring data of any kind XML is a light version of SGML that provides a way of storing and transferring data of any kind XML vs. HTML XML vs. HTML HTML is a markup language used to describe the layout of any kind of information HTML is a markup language used to describe the layout of any kind of information XML is a meta-markup language that can be used to define markup languages that can define the meaning of specific kinds of information XML is a meta-markup language that can be used to define markup languages that can define the meaning of specific kinds of information XML does not predefine any tags XML does not predefine any tags All documents described with an XML-derived language can be parsed with a single parser All documents described with an XML-derived language can be parsed with a single parser AW lecture notes

9 Summer 2005 9 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Design Goals for XML Straightforwardly usable over the Internet Straightforwardly usable over the Internet Support a wide variety of applications Support a wide variety of applications Compatible with SGML Compatible with SGML Easy to write programs which process XML documents Easy to write programs which process XML documents Minimization of optional features Minimization of optional features Human-legible and reasonably clear Human-legible and reasonably clear W3C

10 Summer 2005 10 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University An XML Document Example <class> Prog. for WWW Prog. for WWW ICE1338 ICE1338 <students> Y.K. Ko Y.K. Ko 820304 820304 </student> D.W. Kim D.W. Kim 830512 830512 </student></students></class>

11 Summer 2005 11 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Syntax A flexible text format that is originally designed for large-scale electronic publishing of documents A flexible text format that is originally designed for large-scale electronic publishing of documents An XML document is a hierarchical organization of one or more named elements An XML document is a hierarchical organization of one or more named elements Element: composed of an opening-tag, data (string or another element), and a closing-tag Element: composed of an opening-tag, data (string or another element), and a closing-tag Opening-tag: an element name surrounded by ‘ ’ Opening-tag: an element name surrounded by ‘ ’ Closing-tag: an element name surrounded by ‘ ’ Closing-tag: an element name surrounded by ‘ ’ Attribute: a name-value pair that specifies a property of the element Attribute: a name-value pair that specifies a property of the element An element may have zero or more attributes An element may have zero or more attributes

12 Summer 2005 12 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Syntax (cont.) All XML documents begin with an XML declaration: All XML documents begin with an XML declaration: XML comments are just like HTML comments XML comments are just like HTML comments XML names: XML names: Must begin with a letter or an underscore Must begin with a letter or an underscore They can include digits, hyphens, and periods They can include digits, hyphens, and periods There is no length limitation There is no length limitation They are case sensitive (unlike HTML names) They are case sensitive (unlike HTML names) Syntax rules for XML: Syntax rules for XML: Every XML document defines a single root element, whose opening tag must appear as the first line of the document Every XML document defines a single root element, whose opening tag must appear as the first line of the document Every element that has content must have a closing tag Every element that has content must have a closing tag Tags must be properly nested Tags must be properly nested All attribute values must be quoted All attribute values must be quoted AW lecture notes

13 Summer 2005 13 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University An XML Document Example <class> Prog. for WWW Prog. for WWW ICE1338 ICE1338 <students> Y.K. Ko Y.K. Ko 820304 820304 </student> D.W. Kim D.W. Kim 830512 830512 </student></students></class> An opening-tag A closing-tag An element An attribute The root element A value

14 Summer 2005 14 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Document Structures Logical Structure: tells what elements are to be included in a document and in what order Logical Structure: tells what elements are to be included in a document and in what order A new nested tag needs to be defined to provide more info about the content of a tag A new nested tag needs to be defined to provide more info about the content of a tag Nested tags are better than attributes, because attributes cannot describe structure and the structural complexity may grow Nested tags are better than attributes, because attributes cannot describe structure and the structural complexity may grow Attributes should always be used to identify numbers or names of elements (like HTML id and name attributes) Attributes should always be used to identify numbers or names of elements (like HTML id and name attributes) Physical Structure: governs the content in a document in form of storage units called entities Physical Structure: governs the content in a document in form of storage units called entities AW lecture notes http://tech.irt.org/articles/js212/

15 Summer 2005 15 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Logical Structure Examples......</patient> AW lecture notes <patient> Maggie Maggie Dee Dee Magpie Magpie......</patient> <patient> Maggie Dee Magpie Maggie Dee Magpie......</patient>

16 Summer 2005 16 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Entities Entities allow users to assign a name to some content, and use that name to refer to that content Entities allow users to assign a name to some content, and use that name to refer to that content Used as "macros" for content (e.g., special characters, images, documents) Used as "macros" for content (e.g., special characters, images, documents) Entity Categories Entity Categories The Document Entity: the root of the entity tree, the whole document The Document Entity: the root of the entity tree, the whole document Internal General Entities: association of an arbitrary piece of text with a name Internal General Entities: association of an arbitrary piece of text with a name External General Entities: incorporate content from external files External General Entities: incorporate content from external files http://tech.irt.org/articles/js212/

17 Summer 2005 17 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Internal General Entities Predefined Entities Predefined Entities Character References – refer to Unicode characters using &#decimal; or &#xhex; Character References – refer to Unicode characters using &#decimal; or &#xhex; Internal Entity Declaration Internal Entity Declaration Internal Entity Reference - &entityname; Internal Entity Reference - &entityname; EntityEntity NameReplacement Text The left angle bracket (<) lt< The right angle bracket (>) gt> The ampersand (&) amp& The single quote or apostrophe (') apos' The double quote (") quot" http://tech.irt.org/articles/js212/

18 Summer 2005 18 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University External General Entities Provides a mechanism for dividing a document up into logical chunks, each of which can be stored in a separate file Provides a mechanism for dividing a document up into logical chunks, each of which can be stored in a separate file When the parent file is parsed by an XML processor, it will have the effect of inserting the contents of each of the individual files at that location of the respective entity references When the parent file is parsed by an XML processor, it will have the effect of inserting the contents of each of the individual files at that location of the respective entity references External entities can contain binary data, which can be used to reference images and other non-XML content in the document External entities can contain binary data, which can be used to reference images and other non-XML content in the document http://tech.irt.org/articles/js212/

19 Summer 2005 19 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University External Entity Example <!DOCTYPE [ [...... ] ]>… <document>&section1;...&sectionm;</document> AW lecture notes

20 Summer 2005 20 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University How to Validate the Syntax of an XML Document?

21 Summer 2005 21 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University DTD (Data Type Definitions) A DTD is a set of structural rules called declarations A DTD is a set of structural rules called declarations Specify a set of elements, along with how and where they can appear in a document (in BNF) Specify a set of elements, along with how and where they can appear in a document (in BNF) Purpose: provide a standard form for a collection of XML documents Purpose: provide a standard form for a collection of XML documents All of the declarations of a DTD are enclosed in the block of a DOCTYPE markup declaration All of the declarations of a DTD are enclosed in the block of a DOCTYPE markup declaration DTD declarations have the form: DTD declarations have the form: Possible declaration keywords: Possible declaration keywords: ELEMENT, ATTLIST, ENTITY, and NOTATION ELEMENT, ATTLIST, ENTITY, and NOTATION AW lecture notes

22 Summer 2005 22 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University A DTD Example <!DOCTYPE HYPERLIB [ <!ATTLIST AUTHOR <!ATTLIST AUTHOR function (manager | editor | contrib) #REQUIRED> function (manager | editor | contrib) #REQUIRED> ]> http://lib.ua.ac.be/MAN/WP31/t15.html

23 Summer 2005 23 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University A DTD Example <!DOCTYPE HYPERLIB [ <!ATTLIST AUTHOR <!ATTLIST AUTHOR function (manager | editor | contrib) #REQUIRED> function (manager | editor | contrib) #REQUIRED> ]> http://lib.ua.ac.be/MAN/WP31/t15.html

24 Summer 2005 24 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Internal and External DTDs Internal and External DTDs Internal and External DTDs Internal DTDs Internal DTDs External DTDs External DTDs AW lecture notes

25 Summer 2005 25 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Internal and External DTDs – cont. <!DOCTYPE greeting [ ]> Hello, world! Hello, world! hello.xml (Internal DTD) http://www.w3.org/TR/REC-xml/ Hello, world! Hello, world! hello.xml hello.dtd (External DTD)

26 Summer 2005 26 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University DTD – Elements Element Formats Element Formats Empty Elements Empty Elements Elements with Character Data Elements with Character Data Elements with Children Elements with Children Mixed Content Mixed Content e.g., e.g., http://www.w3schools.com/dtd/default.asp

27 Summer 2005 27 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University DTD – Attributes Attribute Format Attribute Format Example 1 Example 1 DTD : DTD : Valid XML: Valid XML: Example 2 – optional attributes Example 2 – optional attributes DTD: DTD: Valid XML: Valid XML: Example 3 – enumerated attribute values Example 3 – enumerated attribute values DTD: DTD: Valid XML: Valid XML: http://www.w3schools.com/dtd/default.asp

28 Summer 2005 28 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University DTD – Attributes – cont. CDATAThe value is character data (en1|en2|..)The value must be one from an enumerated list IDThe value is a unique id IDREFThe value is the id of another element IDREFSThe value is a list of other ids NMTOKENThe value is a valid XML name NMTOKENSThe value is a list of valid XML names ENTITYThe value is an entity ENTITIESThe value is a list of entities NOTATIONThe value is a name of a notation xml:The value is a predefined xml value Attribute Types Default Values valueThe default value of the attribute #REQUIREDThe attribute value must be included in the element #IMPLIEDThe attribute is optional #FIXED valueThe attribute value is fixed http://www.w3schools.com/dtd/default.asp

29 Summer 2005 29 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Problems with DTD Syntax is different from XML - cannot be parsed with an XML parser Syntax is different from XML - cannot be parsed with an XML parser It is confusing to deal with two different syntactic forms It is confusing to deal with two different syntactic forms DTDs do not allow specification of particular kinds of data DTDs do not allow specification of particular kinds of data AW lecture notes The XML Schema solves these problems. Describes the structure of a document, and data types for elements and attributes in XMLDescribes the structure of a document, and data types for elements and attributes in XML

30 Summer 2005 30 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University How to Handle Different Sets of XML Vocabularies?

31 Summer 2005 31 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Namespaces Markup vocabulary: the collection of all of the element types and attribute names of a markup language (a tag set) Markup vocabulary: the collection of all of the element types and attribute names of a markup language (a tag set) An XML document may define its own tag set and also use that of another tag set - CONFLICTS! An XML document may define its own tag set and also use that of another tag set - CONFLICTS! XML namespace: a collection of names used in XML documents as element types and attribute names XML namespace: a collection of names used in XML documents as element types and attribute names The name of an XML namespace has the form of a URI The name of an XML namespace has the form of a URI AW lecture notes

32 Summer 2005 32 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Namespaces (cont.) A namespace declaration has the form: A namespace declaration has the form: The prefix is a short name for the namespace, which is attached to names from the namespace in the XML document e.g., In the document, you can use ICU vocabulary … In the document, you can use ICU vocabulary … … …

33 Summer 2005 33 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Namespace Example <h:html xmlns:xdc="http://www.xml.com/books" xmlns:h="http://www.w3.org/HTML/1998/html4"> xmlns:h="http://www.w3.org/HTML/1998/html4"> Book Review Book Review XML: A Primer XML: A Primer Author Price Author Price Pages Date Pages Date Simon St. Laurent Simon St. Laurent 31.98 31.98 352 352 1998/01 1998/01 </h:html>

34 Summer 2005 34 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University How to Process XML Documents?

35 Summer 2005 35 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Processors XML Parsers: read XML documents and provide access to their content and structure via DOM (e.g., Xerces, Sun’s Java XML Parser) XML Parsers: read XML documents and provide access to their content and structure via DOM (e.g., Xerces, Sun’s Java XML Parser) Document Filtering (Validation) Document Filtering (Validation) Document Type Declaration (DTD): a grammar for a class of XML documents Document Type Declaration (DTD): a grammar for a class of XML documents XML Schema (XSD): a successor of DTD. Describes the structure of an XML document XML Schema (XSD): a successor of DTD. Describes the structure of an XML document XML Presentation XML Presentation eXtensible Stylesheet Language (XSL): a language to define the transformation and presentation of an XML document eXtensible Stylesheet Language (XSL): a language to define the transformation and presentation of an XML document

36 Summer 2005 36 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML Processors XML Document Databases XML Parser DTD/ XMLSchema XSL Description XSL Processor XML Grammar (Structure) Validation DOM Objects HTML Presentation Parsing Events DOM API SAX API

37 Summer 2005 37 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML APIs SAX (Simple API for XML) – XML-DEV SAX (Simple API for XML) – XML-DEV Stream-based Access Interface (Sequential Access) Stream-based Access Interface (Sequential Access) Notifies an application of a stream of parsing events Notifies an application of a stream of parsing events Needs a Content Handler to handle the parsing events (e.g., start and end of an element) Needs a Content Handler to handle the parsing events (e.g., start and end of an element) Appropriate to handle a large XML document Appropriate to handle a large XML document DOM (Document Object Model) – W3C DOM (Document Object Model) – W3C Object-oriented Access Interface (Random Access) Object-oriented Access Interface (Random Access) Builds a tree of nodes based on the structure and information in an XML document Builds a tree of nodes based on the structure and information in an XML document Types of nodes: Document, Element, Attr, … Types of nodes: Document, Element, Attr, …

38 Summer 2005 38 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University DOM Representation <class> Prog. Lang. Prog. Lang. ICE1341 ICE1341 Y.K. Ko Y.K. Ko 820304 820304 D.W. Kim D.W. Kim 830512 830512 </class> XML Document DOM Representation Document (Root Node) Elements (Child Nodes) Node Values (Text Nodes)

39 Summer 2005 39 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Java API Hierarchy for DOM Node getChildNodes(): NodeList getAttributes(): NamedNodeMap getNodeName(): String getNodeValue(): String appendChild(Node) removeChild(Node) setNodeValue(String) Attr getName(): String getValue(): String setValue(String) CharacterData getData(): String getLength(): int setData(String) Document createAttribute(String): Attr createElement(String): Element createTextNode(String): Text getDocumentElement(): Element getElementByTagName(String): NodeList Element getAttribute(String): String getTagName(): String Text splitText(int): Text Comment

40 Summer 2005 40 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University An Example of Creating DOM Objects from an XML File try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = Document doc = docBuilder.parse(new File("sample.xml")); Element rootEle = doc.getDocumentElement(); Element rootEle = doc.getDocumentElement(); NodeList children = rootEle.getChildNodes(); NodeList children = rootEle.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { for (int i = 0; i < children.getLength(); i++) { Node subEle = children.item(i); Node subEle = children.item(i); … } } catch(Exception e) { e.printStackTrace(); }

41 Summer 2005 41 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Creating a DOM Hierarchy in Java import javax.xml.transform.stream.*; import org.w3c.dom.*; import java.io.*; DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder(); // creates an XML document (in DOM) Document doc = docBuilder.newDocument(); // creates the root element and add to the document Element rootEle = doc.createElement("class"); doc.appendChild(rootEle); // creates a sub-element and add to the root Element ele = doc.createElement("name"); Text val = doc.createTextNode("Prog. for WWW"); ele.appendChild(val); rootEle.appendChild(ele);

42 Summer 2005 42 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Creating an XML File from DOM // Creates a holder for a transformation Source tree DOMSource domSrc = new DOMSource(doc); // Creates an XML stream for the output StreamResult xmlStream = new StreamResult(new File("sample.xml")); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); // Transforms the DOM source into an XML stream transformer.transform(domSrc, xmlStream);

43 Summer 2005 43 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XML-based Languages

44 Summer 2005 44 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Examples of XML-based Languages SVG (Scalable Vector Graphics): A language for describing two-dimensional graphics and graphical applications in XML (http://www.w3.org/TR/SVG/) SVG (Scalable Vector Graphics): A language for describing two-dimensional graphics and graphical applications in XML (http://www.w3.org/TR/SVG/)http://www.w3.org/TR/SVG/ MathML (Mathematical Markup Language): A low-level specification for describing mathematics as a basis for machine to machine communication (http://www.w3.org/Math/) MathML (Mathematical Markup Language): A low-level specification for describing mathematics as a basis for machine to machine communication (http://www.w3.org/Math/)http://www.w3.org/Math/ SMIL (Synchronized Multimedia Integration Language): A language to enable simple authoring of interactive audiovisual presentations (http://www.w3.org/TR/smil20/) SMIL (Synchronized Multimedia Integration Language): A language to enable simple authoring of interactive audiovisual presentations (http://www.w3.org/TR/smil20/)http://www.w3.org/TR/smil20/ RDF, SOAP, WSDL, … RDF, SOAP, WSDL, …

45 Summer 2005 45 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XLink (XML Linking Language) XLink defines how to insert links in XML documents XLink defines how to insert links in XML documents Simple Links Simple Links The list of students. The list of students. Extended Links Extended Links <element xmlns:xlink="http://www.w3.org/1999/xlink/namespace/" xlink:type="extended"> xlink:type="extended">...</element> External Link Sets External Link Sets <annot xmlns:xlink="http://www.w3.org/1999/xlink/namespace/" role="xlink:external-linkset"> role="xlink:external-linkset"> DV's Annotations DV's Annotations </annot> http://daniel.veillard.com/Talks/2000-Linking/slide12-0.html http://www.w3.org/XML/Linking

46 Summer 2005 46 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XPath A language to address parts of an XML document A language to address parts of an XML document http://www.w3.org/TR/xpath Empire Burlesque Bob Dylan USA Columbia 10.90 1985 Hide your heart Bonnie Tyler UK CBS Records 9.90 1988 … Selecting elements in an absolute path /catalog /catalog/cd/price /catalog/cd[price>10.80] Selecting elements in different levels //cd Selecting elements by matching patterns /catalog/cd/* /catalog/*/price /*/*/price Selecting branches /catalog/cd[1] /catalog/cd[last()] Selecting attributes //cd[@country='UK'] http://www.w3schools.com/xpath/xpath_examples.asp

47 Summer 2005 47 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University XPointer Defines the fragment identifier syntax for XML resources Defines the fragment identifier syntax for XML resources Is based on XPath (extension of XPath) Is based on XPath (extension of XPath) Returns a set of nodes, points or ranges within the document Returns a set of nodes, points or ranges within the document e.g., http://www.w3.org/#xpointer(id("foo")) xpointer(/chapter[3]/elem[@name="foo"]) xpointer(/chapter[3]/elem[@name="foo"]) http://daniel.veillard.com/Talks/2000-Linking/slide12-0.html http://www.w3.org/XML/Linking

48 Summer 2005 48 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Related Materials W3C’s XML Web Site: http://www.w3.org/XML/ W3C’s XML Web Site: http://www.w3.org/XML/ http://www.w3.org/XML/ XML Specification: http://www.w3.org/TR/2004/REC-xml- 20040204/ XML Specification: http://www.w3.org/TR/2004/REC-xml- 20040204/ http://www.w3.org/TR/2004/REC-xml- 20040204/ http://www.w3.org/TR/2004/REC-xml- 20040204/ XML Concepts: http://www.w3.org/Talks/General/Concepts.html XML Concepts: http://www.w3.org/Talks/General/Concepts.html http://www.w3.org/Talks/General/Concepts.html DTD Tutorial: http://www.w3schools.com/dtd/ DTD Tutorial: http://www.w3schools.com/dtd/ http://www.w3schools.com/dtd/ XML Schema Tutorial: http://www.w3schools.com/schema/default.asp XML Schema Tutorial: http://www.w3schools.com/schema/default.asp http://www.w3schools.com/schema/default.asp W3C’s XSL Site: http://www.w3.org/Style/XSL/ W3C’s XSL Site: http://www.w3.org/Style/XSL/ http://www.w3.org/Style/XSL/ XML Entities and their Applications: http://tech.irt.org/articles/js212/ XML Entities and their Applications: http://tech.irt.org/articles/js212/ http://tech.irt.org/articles/js212/ Other XML-related Notes: http://www.w3.org/XML/notes.html Other XML-related Notes: http://www.w3.org/XML/notes.html http://www.w3.org/XML/notes.html

49 Summer 2005 49 ICE 0534/ICE1338 – WWW © In-Young Ko, Information and Communications University Related Materials W3C Document Object Model (www.w3.org/DOM/) W3C Document Object Model (www.w3.org/DOM/)www.w3.org/DOM/ A simple way to read an XML file in Java (www.developerfusion.com/show/2064/) A simple way to read an XML file in Java (www.developerfusion.com/show/2064/)www.developerfusion.com/show/2064/ Working with XML (java.sun.com/xml/jaxp/dist/1.0.1/docs/tutorial/index.html) Working with XML (java.sun.com/xml/jaxp/dist/1.0.1/docs/tutorial/index.html)java.sun.com/xml/jaxp/dist/1.0.1/docs/tutorial/index.html DTD Tutorial (http://www.w3schools.com/dtd/default.asp) DTD Tutorial (http://www.w3schools.com/dtd/default.asp)http://www.w3schools.com/dtd/default.asp XML Specification (http://www.w3.org/TR/REC-xml/) XML Specification (http://www.w3.org/TR/REC-xml/)http://www.w3.org/TR/REC-xml/ Java Technology and XML FAQs (java.sun.com/xml/faq.html) Java Technology and XML FAQs (java.sun.com/xml/faq.html)java.sun.com/xml/faq.html Java API Manual (java.sun.com/j2se/1.4.2/docs/api/) Java API Manual (java.sun.com/j2se/1.4.2/docs/api/)java.sun.com/j2se/1.4.2/docs/api/ See org.w3c.dom and javax.xml.parsers See org.w3c.dom and javax.xml.parsers XML.org (www.xml.org) XML.org (www.xml.org)www.xml.org


Download ppt "ICE0534 – Web-based Software Development ICE1338 – Programming for WWW Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information."

Similar presentations


Ads by Google