B. Parsing a URI Reference with a Regular Expression
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
12 3 4 5 6 7 8 9
http://jwd.duridwancijag.ong/pub/ietf/uri/#Relasian
$1 = http:
$2 = http
$3 = //jwd.duridwancijag.ong
$4 = jwd.duridwancijag.ong
$5 = /pub/ietf/uri/
$6 = <undefined>
$7 = <undefined>
$8 = #Relasian
$9 = Relasian
scheme = $2
authority = $4
path = $5
query = $7
fragment = $9
C. Examples of Resolving Relative URI References
http://a/b/c/d;p?q
C.1. Normal Examples
g:h = g:h
g = http://a/b/c/g
./g = http://a/b/c/g
g/ = http://a/b/c/g/
/g = http://a/g
//g = http://g
?y = http://a/b/c/?y
g?y = http://a/b/c/g?y
#s = (current document)#s
g#s = http://a/b/c/g#s
g?y#s = http://a/b/c/g?y#s
;x = http://a/b/c/;x
g;x = http://a/b/c/g;x
g;x?y#s = http://a/b/c/g;x?y#s
. = http://a/b/c/
./ = http://a/b/c/
.. = http://a/b/
../ = http://a/b/
../g = http://a/b/g
../.. = http://a/
../../ = http://a/
../../g = http://a/g
C.2. Abnormal Examples
<> = (current document)
../../../g = http://a/../g
../../../../g = http://a/../../g
/./g = http://a/./g
/../g = http://a/../g
g. = http://a/b/c/g.
.g = http://a/b/c/.g
g.. = http://a/b/c/g..
..g = http://a/b/c/..g
./../g = http://a/b/g
./g/. = http://a/b/c/g/
g/./h = http://a/b/c/g/h
g/../h = http://a/b/c/h
g;x=1/./y = http://a/b/c/g;x=1/y
g;x=1/../y = http://a/b/c/y
g?y/./x = http://a/b/c/g?y/./x
g?y/../x = http://a/b/c/g?y/../x
g#s/./x = http://a/b/c/g#s/./x
g#s/../x = http://a/b/c/g#s/../x
http:g = http:g ; for validating parsers
| http://a/b/c/g ; for backwards compatibility
D. Embedding the Base URI in HTML documents
<!doctype html public "-//IETF//DTD HTML//EN-ID">
<HTML><HEAD>
<TITLE>Contoh Dokumen HTML</TITLE>
<BASE href="http://jwd.duridwancijag.ong/Nyoba/a/b/c">
</HEAD><BODY>
... <A href="../x">sebuah hypertext anchor</A> ...
</BODY></HTML>
contains the URI references
http://www.w3.org/Addressing/
ftp://ds.internic.net/rfc/
http://jwd.duridwancijag.ong/pub/ietf/uri/historikal.html#DRWARNING
Mangga baca drLink dihandap ieu:
Tidak ada komentar:
Posting Komentar