You are on page 1of 5

ek e e (XML)

ekee 

ekee Syntax

Xml elements

ek e e (XML)
XML) u   |  
 
:


 

XML e a c eXtensible Markup Language.e



 (Transport) e  k
 


 e


  t!"  n $
 e 

% i  '  
 
 '
%
 '  
 e
(' 
e 
i 
  ' 
%

e 
XML Document e u*
 
1.<?xml version="1.0"?>
2.<note>
3.<to>Tove</to>
4.<from>Jani</from>
5.<heading>Reminder</heading>
6.<body>Don't forget me this weekend!</body>
7.</note>

XML $
 !
 HTML e Javascript
' ei 
i  i e
$' !
 
XML e HTML  e??
e??

e 
XML 


 + 
 o  k  
p*$ (display) 
a! * HTML 


 + 
*

/p*$ (display) 
XML ' carry   HTML ' *

XML e 
 ic' *
%
% u! u*
  <note>,<to> e 
 ic' *
 +
HTML e i .
  *
+   
 


%
 % <head>,<title> i'
*

ekee k/ T ( XML Tr ee)


 
: o
/

 o
/ 

ekee kn e 
/k ' 2  3' 4  %
$   "the root"/(
+ 
5
') *  
/$

 "the
leaves"/(!
'
')
ekee e  
 
6'  ( ic') 7 u*
 8 * 
 *i 
9
%
% e ('  


1.<?xml version="1.0" encoding="ISO-8859-1"?>
2.<note>

3.<to>Tove</to>
4.<from>Jani</from>
5.<heading>Reminder</heading>
6.<body>Don't forget me this weekend!</body>
7.</note>

ei 
 p 
i8 * e 
:
;
(Declaration) *
 + % e
e 
XML Document.e
 *
+ e
(
 1.0 e e
e
 


 + ISO-8859-1,% 


i  ' *' !
  uft-8 (iu

(t e
)
! 
i8 ei kn root element
1.<note>

e ! 48 
i  ei root e child element(to, from, heading, and body)
1.<to>Tove</to>
2.<from>Jani</from>
3.<heading>Reminder</heading>
4.<body>Don't forget me this weekend!</body>
5.</note>

$; 
i8 ei root element e 
p iA' 
1.</note>

ei u*
   ! i a
 ' !
  % e
e e 
XML Document %
 e 

/ /7B Jani
e
+  Tove e
+
XML DOCUMENT e '( ) '*+ +
+ ,)- .
p' 
XML Document e e 
root element 
' e
c a
 element 
 Parent.
ei root element +
5
a
 element 

sub element (child element) 
' !
 %:
1.<root>
2.<child>
3.<subchild>.....</subchild>
4.</child>
5.</root>

Parent,Child,Sibling ei $b 
6'  in  . m  
'Parent element e child 


e i !%
 /Level e child 
 Sibling/*
((
i 

) 
p'8 in (' 
e eu 
' !
 % HTML e 


u! + e 
i represent  XMl e
01.<bookstore>
02.<book category="COOKING">
03.<title lang="en">Everyday Italian</title>
04.<author>Giada De Laurentiis</author>
05.<year>2005</year>
06.<price>30.00</price>
07.</book>
08.<book category="CHILDREN">
09.<title lang="en">Harry Potter</title>
10.<author>J K. Rowling</author>
11.<year>2005</year>
12.<price>29.99</price>
13.</book>
14.<book category="WEB">
15.<title lang="en">Learning XML</title>
16.<author>Erik T. Ray</author>
17.<year>2003</year>
18.<price>39.95</price>
19.</book>
20.</bookstore>

e
 root element c <bookstore>

ekee /) ( XML Synt ax Rul e)


 
: o


 o
 

XML e  '   (Syntax Rule) a  e %Ek (Logical).e


$
e 


*
i 
p):  XML DOCUMENT e a<i / p :' (CLOSING TAG)
TAG) B) .
e 
HTML document e 
p 
 

$   n XML e e
(  % e 

 
p 
 


8u
 G
 u*
  declaration 
i closing tag +
 e
(  G
 ei 
i8 XML document e

 a$i G
XML e TAG g  CASE SENSI TI VE
<Letter> Tag 8 <letter> tag  (nopening e closing tag a$i e i ak '  a
E +
 I/

' ak e 

%


1.<Message>This is incorrect</message>
2.<message>This is correct</message>

"Opening and closing tags"  "Start and end tags" o 


G!
%
(
 
 ' !
  e 
XML ELEMENT / * NESTED .) .
HTML e G' e(
 *' !
 
1.<b><i>This text is bold and italic</b></i>

 n XML e(
 
7
e
(  XML e ,'  e(

1.<b><i>This text is bold and italic</i></b>

B (
 nested '  e a c <i> element 8 <b> e (' $  G+ $;o '  e ('
XML ELEMENT e ATTRI BUTE  ) B) .
HTML e ' XML e o attribute 
' !
 ' i(
  
(' 
' %:
1.<note date="12/11/2007">
2.<to>Tove</to>
3.<from>Jani</from>
4.</note>

ekee uGH+ ( XML El ement s)


 
: oG


 oG
 

e 
XML document G XML elements 

 .  e 

 %* $

 G '
 e
e 
'title'
element e . 
e 
XML element c 
 e 
in start tag  $   end tag !%n
 + ie 
in ('  o in 
' !
 ,k 
' !
 
*
o 
' !

01.<bookstore>
02.<book category="CHILDREN">
03.<title>Harry Potter</title>
04.<author>J K. Rowling</author>

05.<year>2005</year>
06.<price>29.99</price>
07.</book>
08.<book category="WEB">
09.<title>Learning XML</title>
10.<author>Erik T. Ray</author>
11.<year>2003</year>
12.<price>39.95</price>
13.</book>
14.</bookstore>

e
 <bookstore> e <book> e element content +
 '

element    <author> e
text content +
 e
kk  
XML ++ Gd )
XML elements e 
 *G
G 7 ;G a$i a  ' 


8 ak ,
m

a %
 7h ' !



 
7h/punctuation 

 
*G $  

xml (or XML, or Xml, etc) e


*G 

%



 . N


G
/space 

%


%
 ak 


%
 
 * O 4
d'
i

++ G/:
G/:

 e  
  (
 ekt underscore *G $b 
*
 *' !
  % <first_name>, <last_name>.

 %' kp e 

%
G ''i (
 % <book_title> e G: <the_title_of_the_book>.

9
 
iN "-" * 
' !
 % %*  <first-name> '
 
 NoG
 ' !
 ! first
 name G
 ' 7
c
":" k
 *G
 eIG %

XML ATTRI BUTE
XML elements e attribute 

G $; 
 ' e *'%
1.<friend age="23">Samantha</friend>

You might also like