Download presentation
Presentation is loading. Please wait.
Published byClifford Mitchell Modified over 9 years ago
1
SNU OOPSLA Lab. XML Documents 2 : Additional issues The ubiquitous XML(3) © copyright 2001 SNU OOPSLA Lab.
2
SNU OOPSLA Lab. The ubiquitous XML 2 Additional Issues XML Link White space Name space
3
SNU OOPSLA Lab. The ubiquitous XML 3 Contents of XML Link HTML Link vs. XML Link concept of XML Link simple link extended link XPointer XML Link
4
SNU OOPSLA Lab. The ubiquitous XML 4 HTML Link vs. XML Link HTML Link URL 은 하나의 문서전체만을 가리킬 뿐, 문서 내 부분을 가리킬 수 있는 방법이 없다. Document 들 사이의 연관성에 대한 개념이 없다. 한 방향 LINK 만 가능하다 XML Link document 의 임의의 위치를 가리킬 수 있는 방법제공 다양한 element 를 link 할 수 있다. (cf. ‘A’ element in HTML) 다방향 Link 참조, 주석, 각주 등을 쉽게 처리할 수 있다.
5
SNU OOPSLA Lab. The ubiquitous XML 5 Concept of Xlink (1/12) XLL (eXtensible Linking Language) Xlink define how one document link another document in fact, URL(URI) Xpointer define how one document link the component of documents
6
SNU OOPSLA Lab. The ubiquitous XML 6 Concept of Xlink (2/12) contains only one resource locator only the Href and xml-link attributes are required any name can be chosen for the linking element See book 9 for details See Section 9 of the Procedures Manual XML Link
7
SNU OOPSLA Lab. The ubiquitous XML 7 Concept of Xlink (3/12) Source a phrase that directs the reader’s attention to other information Target is located at the start of the required text XML Link
8
SNU OOPSLA Lab. The ubiquitous XML 8 Concept of Xlink (4/12) Resource target object Linking element source Traversal the act of moving from the liking element to the resource See More Information for details. linking element More Information The details are…… resource traversal XML Link
9
SNU OOPSLA Lab. The ubiquitous XML 9 Concept of Xlink (5/12) Objects are identified using the URL mechanism See Details … Details The details are …... Doc9 xml MyServe server MyCorp XML Link
10
SNU OOPSLA Lab. The ubiquitous XML 10 Concept of Xlink (6/12) Title it is useful for simple links to be labeled, so that the user can decide whether it would be profitable to follow the link <!ATTLIST link … title CDATA #IMPLIED> … are you going to Scarborough fair? Role is used to create categories of link that can be accessed by specialized browsers <!ATTLIST link … role CDATA #IMPLIED> … are you going to Scarborough fair? XML Link
11
SNU OOPSLA Lab. The ubiquitous XML 11 Concept of Xlink (7/12) Content role and content title locators in extended links are labeled with the title attribute extended link itself, if it is an in-line link, should also have a title and role XML Link
12
SNU OOPSLA Lab. The ubiquitous XML 12 Concept of Xlink (8/12) <!ATTLIST extend … content-role CDATA #IMPLIED content-title CDATA #IMPLIED> Are you going to Scarborough fair? … Are you going to Scarborough fair? location history A popular seaside town in Yorkshire is Scarborough history song XML Link
13
SNU OOPSLA Lab. The ubiquitous XML 13 Concept of Xlink(9/12) The method for locating entire documents See details Linking a specific element in the current file See details, part 3 entire document is delivered Indicating that only referenced part of the document is required See details, part 3 XML Link URL
14
SNU OOPSLA Lab. The ubiquitous XML 14 Concept of Xlink (10/12) Link Behavior (1/2) Actuate user: the links only traversed when explicitly selected by the user auto: the link is activated automatically as soon as the linking element is presented to the user Show replace: the browser replaces the source text with the resource required embed: the resource is brought to and embedded in the source text new: the browser opens a new window to display the resource, leaving the original window on-screen XML Link
15
SNU OOPSLA Lab. The ubiquitous XML 15 Concept of Xlink (11/12) Link Behavior(2/2) The show and actuate attributes also appearing in the extended links XML Link
16
SNU OOPSLA Lab. The ubiquitous XML 16 Concept of Xlink (12/12) Simple link the primitive one-directional linking scheme, but make it possible to traverse links between documents Extended link multi-directional linking scheme an extended link contains a number of locator elements, each one points to a resource XML Link
17
SNU OOPSLA Lab. The ubiquitous XML 17 Simple Link Attributes in the linking element can influence the means by which a link can be activated a link could be activated by the person(‘user’ link) directly by the application(‘auto’ link) the presentation technique required once it has been activated application may jump to the specified resource(‘replace’) display the resource in another window(‘new’) insert the resource into the original text(‘embed’) XML Link
18
SNU OOPSLA Lab. The ubiquitous XML 18 Extended Link (1/8) resources can be cross-related an extended link contains a number of locator elements, each one points to a resource XML Link
19
SNU OOPSLA Lab. The ubiquitous XML 19 Extended Links (2/8) refer to a number of resources by including embedded resource locators each locator is stored in a locator element all related locator elements are grouped within an extended element the DTD author must ensure that the extended element can contain the locator element, as well as any DTD specific elements appropriate at this point XML Link
20
SNU OOPSLA Lab. The ubiquitous XML 20 Extended Links (3/8) Here are some extended links: Locator 1, Locator 2 Here are some extended links: Locator1, Locator2. XML Link
21
SNU OOPSLA Lab. The ubiquitous XML 21 Extended Link (4/8) In-line links a link that serves as one of its own resources a link source that is embedded within the text Out-of-line links a link that does not serve as one of its own resources should be considered when a read-only document is involved different links are required for different groups of people, where seeing other’s links is confusing XML Link
22
SNU OOPSLA Lab. The ubiquitous XML 22 Extended Link (5/8) Out-of-line link provides facility of separating the extended link from all the resources it defines may physically appear in-line, in the sense that it is placed in the flow of text a more obvious place to put out-of-line links is at the top of the document XML Link
23
SNU OOPSLA Lab. The ubiquitous XML 23 Extended Link (6/8) The Inline attribute must be set to ‘false’ to identify an out-of-line link Locator 1 Locator 2 resource Document ADocument B XML Link
24
SNU OOPSLA Lab. The ubiquitous XML 24 Extended Link (7/8) Extended link group(1/2) a number of extended document pointers are used to identify all the inter-linked documents they are contained in an extended group element => all the documents concerned are deemed to be pointers to each other XML Link
25
SNU OOPSLA Lab. The ubiquitous XML 25 Extended Link (8/8) Extended link group(2/2) Group element other documents in a group of inter-linked documents can be identified with steps attribute contains a value stating how many steps to take which contains document element with href attribute Document Hub XML Link
26
SNU OOPSLA Lab. The ubiquitous XML 26 Xpointer (1/13) a mechanism for identifying a designated resource by its location Instructions(location terms) in an XPointer refer to the element hierarchy tree include references to siblings, children and ancestors are read from left to right XML Link
27
SNU OOPSLA Lab. The ubiquitous XML 27 Xpointer (2/13) Examples http://MyServe.MyCorp.com/ xml/doc9#ROOT()CHILD(3,chap)STRING(7,”Napole on”,0) http:// MyServe.MyCorp.com/ xml/doc9? XML- XPTR=ROOT()CHILD(3,chap)STRING(7,”Napoleon ”,0) XML Link
28
SNU OOPSLA Lab. The ubiquitous XML 28 Xpointer (3/13) Absolute Locations(1/2) HERE() identifies the current element(the linking element itself) ID() specifies an element containing an attribute of type ID ID(sec17) … ’ HTML() specifies the name of an Anchor element in an HTML document HTML(para3) The third paragraph. … XML Link
29
SNU OOPSLA Lab. The ubiquitous XML 29 Xpointer (4/13) Absolute Locations(2/2) ROOT() identifies the entire document as the container of the target resource DITTO() specifies the result of the first search as the starting- point for this second search XML Link
30
SNU OOPSLA Lab. The ubiquitous XML 30 Xpointer (5/13) Relative Locations(1/9) CHILD() specifies a child of the current element CHILD(3,.) … <1 … <2 … <3 CHILD(3, *) 13 <1 High Str., <2 NewTown <3 XML Link
31
SNU OOPSLA Lab. The ubiquitous XML 31 Xpointer (6/13) CHILD(1, *CDATA) 13 High Str.,<1 NewTown CHILD(3, para) … <1 … … <2 … … <3 XML Link Relative Locations(2/9)
32
SNU OOPSLA Lab. The ubiquitous XML 32 Xpointer (7/13) CHILD(3, para, status, secret) … <1 … <2 … … <3 CHILD(2, para, author, “D. Adams”) … … <1 … … <2 XML Link Relative Locations(3/9)
33
SNU OOPSLA Lab. The ubiquitous XML 33 Xpointer (8/13) CHILD(3, para, status, *IMPLIED) … … <1 … <2 … … <3 CHILD(3, PARA, STATUS, *) … <1 … … <2 … <3 … XML Link Relative Locations(4/9)
34
SNU OOPSLA Lab. The ubiquitous XML 34 Xpointer (9/13) ANCESTOR() specifies a search through enclosing elements FSIBLING() identifies a following sibling to select next element: … … <1 to select the penultimate element: … … < -2 … < -1 XML Link Relative Locations(5/9)
35
SNU OOPSLA Lab. The ubiquitous XML 35 Xpointer (10/13) PSIBLING() identifies a previous sibling to the current element to select the previous element … < 1 … to select the second element in the enclosing element … < -1 … < -2 … XML Link Relative Locations(6/9)
36
SNU OOPSLA Lab. The ubiquitous XML 36 Xpointer (11/13) DESCENDANT() indicates an element anywhere within the location source FOLLOWING() has a similar effect as DESCENDANT, except that it not bounded by the current element’s end-tag, but searches on to the end of the document PRECEDING() initiates a search back through the document, ignoring document hierarchies XML Link Relative Locations(7/9)
37
SNU OOPSLA Lab. The ubiquitous XML 37 Xpointer (12/13) STRING() locates a given letter, word, phrase or other string of text, such as ‘Napoleon the Emperor’ the first parameter is an occurrence counter the second parameter is the string to find STRING(1, ‘Napoleon the Emperor’, 0) Using the N element for name and Occ for occupation, “Napoleon the Emperor” is coded… <1 XML Link Relative Locations(8/9)
38
SNU OOPSLA Lab. The ubiquitous XML 38 Xpointer(13/13) STRING() tags are transparent to the search: STRING(1, ‘Napoleon the Emperor’, 0) Using the N element for name and Occ for occupation, “Napoleon the Emperor” is coded… <1 Napoleon the Emperor <2 the third parameter is a value specifying an offset from the start of the search text STRING(1, ‘Napoleon the Emperor’, 7) Using the N element for name and Occ for occupation, “Napoleon the Emperor” is coded… <1 Napoleon the Emperor <2 XML Link Relative Locations(9/9)
39
SNU OOPSLA Lab. The ubiquitous XML 39 Additional Issues XML Link White space Name space
40
SNU OOPSLA Lab. The ubiquitous XML 40 Contents of White space concept Line-end normalization White space in markup Element content space Preserved space Ambiguous space White space
41
SNU OOPSLA Lab. The ubiquitous XML 41 Concept of white space ‘white space’ is used to describe a number of miscellaneous characters that have no visual appearance, but in some way affect the formatting of a document White space
42
SNU OOPSLA Lab. The ubiquitous XML 42 Line-end normalization ASCII standard includes two special characters, these are the CR and LF characters XML processor uses the LF character to terminate lines A sequence of identical line-end codes are treated separately. A Macintosh [CR] Data file.[CR] A Macintosh [LF] Data file.[LF] A Macintosh [CR][LF] Data file.[CR]{LF} White space
43
SNU OOPSLA Lab. The ubiquitous XML 43 White space in markup The two examples below are deemed to be equivalent <book Issue = “3” Date = “15/3/97” > White space
44
SNU OOPSLA Lab. The ubiquitous XML 44 Element content space Document authors may choose to insert white space in order to improve the presentation. For example, the second document fragment below is easier to read than the first: Neil Bradley </auth >… Neil Bradley … White space
45
SNU OOPSLA Lab. The ubiquitous XML 45 Preserved space A distinction is made between act of leaving all white space characters intact, and normalizing white space back to a single character. When left intact, the white space is said to be preserved. When normalized, it is said to have collapsed. The document author has some control over normalization of white space in the text, using a reserved attribute named ‘xml:space’. Mrs White Newtown England Mrs White Newtown England White space
46
SNU OOPSLA Lab. The ubiquitous XML 46 Ambiguous space Ambiguities may arise as to whether some white space is intended to be part of the document, or is just present to make the data file more readable The problem is deciding whether or not the Line-end code after the Paragraph start-tag, or line-end code at the end of the text may be omitted or retained. Is this line of text : [CR] To be kept separate from this one? Is this line of text : To be kept separate from this one? Is this line of text : To be kept separate from this one? White space
47
SNU OOPSLA Lab. The ubiquitous XML 47 Ambiguous space HTML All white space between block elements is ignored SGML Focus is on the line-end codes rather than on white space in general. RS character identifies and RE character identifies take the roles of record delimiters. White space
48
SNU OOPSLA Lab. The ubiquitous XML 48 Additional Issues XML Link White space Name space
49
SNU OOPSLA Lab. The ubiquitous XML 49 Contents of Name space Compound Documents The Standard Namespace identification Using name spaces Simplification techniques DTD issues Name space
50
SNU OOPSLA Lab. The ubiquitous XML 50 Compound Documents It is possible for a single XML document to contain fragments that are defined in different DTDs. The well-formed nature of all XML structures makes it relatively simply to embed ‘foreign’ structures in documents. But there are two problems to identify which schema a particular element belongs to. How to avoid duplication of element and attribute names. Name space
51
SNU OOPSLA Lab. The ubiquitous XML 51 The Namespaces standard was produced by the W3C, and gained recommended status in Jan. 1999. This standard focuses on two issues It provides a mechanism for identifying the namespaces used in the document. It identifies which namespace a particular element or attribute belongs to. The Standard Name space
52
SNU OOPSLA Lab. The ubiquitous XML 52 Most standards can now be identified with a specific location on the Web. The Namespaces standard uses URLs to identify each namespace. Namespace identification Name space
53
SNU OOPSLA Lab. The ubiquitous XML 53 Using name spaces Namespaces are defined using attributes.the attribute name ‘xmlns’ is used to declare a namespace, and at the same time declare the prefix that will stand in for the full URL in element and attribute names. Attributes from one namespace can be used in elements from another. http://www.w3.org/TR/REC-html40 … An HTML paragraph. Name space
54
SNU OOPSLA Lab. The ubiquitous XML 54 Simplification techniques When every element and attribute has a prefix, the document can become difficult to read, and the extra characters certainly add to its size. Fortunately, Standard includes the concept of a default namespace. The default namespace can be changed at any point in the document hierarchy. <book xmlns=“file:/DTDs/book.dtd” xmlns:X=http://www.w3.org/TR/REC-html40>http://www.w3.org/TR/REC-html40 … … … http://www.w3.org/TR/REC-html40 … …... …... Name space
55
SNU OOPSLA Lab. The ubiquitous XML 55 DTD issues In order to parse documents against a DTD, it is necessary to include the prefixes in the element definitions: <!ELEMENT document (shoe|boot|slipper| veh:bonnet| veh:boot| veh:wheel)*> The namespace definition can also be included in the DTD. The DTD must also include references to all allowed children in the element content models, regardless of the namespace they may belong to. Name space
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.