You are on page 1of 18

CHAPTER 11 Introduction to XML

by Eric Ladd

In this chapter
Why XML? 306 XML Overview 310 Linking with XML 316 Using Style Sheets with XML 321 The XSL Requirements Summary 322 Applicati ns 322 XML S !tware 323 Re!erences 325 h! XML" "TML is a !airly simple language#simple en ugh t have ma$e We% pu%lishing accessi%le t many pe ple& 'ts rules are als straight! rwar$ en ugh that sc res ! pr grammers have written "TML e$iting t ls that ena%le c ntent pu%lishers t prepare a $ cument with ut kn wing any "TML& This has pene$ up the We% t even m re pe ple& 'n$ee$( "TML)s ease ! use is pr %a%ly ne ! the %iggest reas ns ! r the e*pl sive gr wth ! the We%& "TML( h wever( is n t with ut its pr %lems& + r ne thing( it is t restrictive& , u pr %a%ly kn w that "TML is an applicati n ! the Stan$ar$ -enerali.e$ Markup Language /S-ML0( restricte$ t a certain set ! rules& A!ter y u start using S-ML in a speci!ic way( y u sacri!ice much ! the !le*i%ility y u get %y using 1less c nstraine$2 S-ML& This means that y u are less likely t %e a%le t $escri%e m re c mple* $ cuments with "TML r with any restricte$ ! rm ! S-ML& ,et an ther issue with "TML is that( as it ev lve$( its tags %ecame m re ! cuse$ n $escri%ing h w c ntent sh ul$ %e presente$ rather than n what the c ntent was& , u rea$ in 3hapter 4( 1Style Sheets(2 h w the i$ea ! a style sheet helps t separate the nature ! c ntent !r m its presentati n& Style sheets are a step in the right $irecti n( %ut they have nly recently %een a$ pte$( an$ it will take s me time %e! re "TML %ec mes c mpletely !ree ! tags that $escri%e presentati n& What)s the s luti n t the pr %lem with "TML then? The answer is the eXtensible Markup Language /XML0& 5ecause XML stays ! cuse$ n c ntent $escripti n( y u $ n)t run the risk ! having any XML markup speci!ying h w t present the c ntent& A$$iti nally( XML is highly e*tensi%le( meaning that it is !le*i%le en ugh t han$le a simple $ cument( such as a h me page( r a huge $ cument( such as War and Peace& This chapter intr $uces y u t XML( sh ws y u h w t use it( an$ e*plains why it is s imp rtant t the !uture ! We% pu%lishing& T %etter un$erstan$ why XML is the ne*t wave in We% c ntent markup( it is help!ul t c nsi$er the alternatives an$ t see h w they !all sh rt ! meeting the anticipate$ nee$s ! % th c ntent pr vi$ers an$ c nsumers& 6isc unting XML ! r the m ment( nly tw pti ns e*ist ! r marking up We% c ntent7 "TML an$ S-ML&

Pro#$e%s &ith HTML The remarks in the previ us paragraphs hint at s me ! the weaknesses inherent in "TML& The !irst ! these is that many "TML tags are geare$ t war$ $escri%ing h w c ntent sh ul$ l k n a %r wser screen instea$ ! saying what the c ntent is /as a $ cument $escripti n language sh ul$0& 3 nsi$er the many te*t ! rmatting tags in "TML7 ' ' ' ' '
859 ! r % l$!ace 8'9 ! r italic 8TT9 ! r !i*e$:wi$th characters 8+O;T9 ! r changing type!ace( type si.e( an$ c l r 83<;T<R9 ! r centering te*t( images( an$ ther page elements

<ach ! these tags m $i!ies a presentati n:relate$ pr perty ! an %=ect n the page( %ut they give a%s lutely n in$icati n ! the meaning ! the %=ect& An in$e*ing pr gram( ! r e*ample( w ul$ have n sense ! the signi!icance ! the ! ll wing markup7
<B>Warning! Pressing Ctrl+Alt+Del will restart your machine!</B>

A situati n such as the ne a% ve is why s me ne trie$ t intr $uce a 8;OT<9 tag int "TML t han$le a$m nishments& An in$e*er w ul$ have a much easier time un$erstan$ing s mething like this7
<NOT C!A""#$WA%N&N'$>Warning! Pressing Ctrl+Alt+Del will restart your machine!<(NOT >

'n this case( it is clear !r m the markup that the te*t %etween 8;OT<9 an$ 8>;OT<9 is a message enc uraging cauti n& T "TML)s cre$it( it $ es have s me tags that in$icate the meaning ! the te*t they mark up& The ! ll wing tags( ! r e*ample( all c nvey s me sense ! meaning7 ' ' ' ' ' ' ' '
8A66R<SS9 ! r email an$ p stal a$$resses 85LO3?@UOT<9 ! r in$ente$( qu te$ te*t 83'T<9 ! r citati ns 86+;9 ! r the $e!ining instance ! a term 8<M9 ! r te*t t %e emphasi.e$ 8?569 ! r key% ar$ input 8@9 ! r qu te$ te*t 8STRO;-9 ! r str ng emphasis

, u c ul$ easily generate a gl ssary ! key terms !r m a $ cument marke$ up with the 86+;9 tag( ! r e*ample& All the pr gram w ul$ have t $ is strip ut all the w r$s ! un$ %etween 86+;9an$ 8A6+;9 tags an$ ! rm a list !r m them& This simple e*ample $em nstrates what kin$ ! aut mati n is p ssi%le when y u have marke$ te*t with tags that signi!y meaning&
()TE* A num%er ! pr p se$ tags in$icate meaning( alth ugh many $i$ n t !in$ their way int the "TML B&C rec mmen$ati n& These inclu$e D 8AU9 ! r an auth r)s name D 8E<RSO;9 ! r a pers n)s name

With XML)s star n the rise( it is unclear whether these tags will ever %ec me part ! the "TML stan$ar$&

"TML is n t the %est at $escri%ing what c ntent means( %ut the pr %lems $ n)t st p there& An ther issue is that "TML is n t !le*i%le en ugh t pr perly mark up the wi$e variety ! $ cuments that pe ple want t pu%lish electr nically& The nly pieces ! a $ cument that "TML can $escri%e are a 8"<A69 an$ a 85O6,9& 5ut what a% ut $ cument c nstructs( such as a%stracts( chapters( an$ %i%li graphies? 3urrently( n "TML tags can acc mm $ate these kin$s ! $ cument $ivisi ns& 'n resp nse t the i$ea that "TML is n t !le*i%le en ugh( y u may %e thinking( 1"ey( i! "TML $ esn)t $ what s me ne wants it t $ ( an ther tag will %e intr $uce$ s n en ugh&2 That is actually an ther pr %lem with "TML& 5r wser s !tware c mpanies have intr $uce$ sc res ! new( pr prietary tags in an e!! rt t lure users t their pr $ucts& The W rl$ Wi$e We% 3 ns rtium /WF30 has( ver time( inc rp rate$ many ! these tags int the "TML stan$ar$( %ut many tags are still use$ in s me "TML $ cuments that w n)t %e ren$ere$ pr perly n all %r wsers& '! the issues raise$ s !ar are n t en ugh( here is ne m re %r wser:relate$ pr %lem7 5r wsers are t ! rgiving ! %a$ "TML c $e& 3 nsi$er the ! ll wing "TML7
<) AD> <* TA + ,WO%D#$-a. )T*! .ocument> <BOD, B'CO!O%#$//0*11$> <)2>An &m3er4ect )T*! Document</)5> <6!> <!&>*ost -rowsers will ren.er this .ocument in a rea.a-le way7 <!&>An )T*! 8ali.ator woul. -e re9uire. to catch the synta: errors7 </6!>

Syntactically speaking( this c $e c ntains several err rs7 ' 8T'TL<9 is a require$ element( an$ the $ cument has n title& ' The ?<,WOR6 attri%ute in the 8M<TA9 tag has a mismatche$ qu tati n mark /10& ' The value ! the 5-3OLOR attri%ute is invali$ %ecause he*a$ecimal values can %e ma$e up nly with the $igits CG4 an$ AG+& Als ( the he*a$ecimal value sh ul$ %e !!set %y a p un$ sign /H0& ' The hea$ing style tags are mismatche$& ' ; cl sing 8A5O6,9 an$ 8A"TML9 tags are present& 6espite these err rs( l k at +igure II&IJ this !igure sh ws the $ cument thr ugh ;etscape ;avigat r& 't l ks pretty g $( $ esn)t it? Why sh ul$ auth rs a$here t pr per "TML synta* when m st p pular %r wsers( in the a%sence ! g $ synta*( can usually !igure ut what the user wants? The !act that %r wsers are s ! rgiving has le$ t very sl ppy "TML auth ring ha%its& This is a pr %lem %ecause( i! the tren$ t war$ aut mate$ pr cessing ! We% $ cuments c ntinues( it will %e imperative ! r all $ cuments t a$here t pr per synta*& Otherwise( it will %e imp ssi%le ! r pr grams t c rrectly parse them& 5y n w y u are pr %a%ly l sing c n!i$ence in "TML)s capa%ility t meet the electr nic pu%lishing nee$s ! the !uture& Rest assure$( y u w ul$ n t %e al ne in !eeling that way& Many c ntent pr vi$ers als raise$ these c ncerns an$ escalate$ the situati n t the p int that the WF3 %egan t c nsi$er alternatives& One ! the easiest alternatives t c nsi$er was that ! g ing %ack

t "TML)s parent language#S-ML& As the ne*t secti n illustrates( h wever( ! r a set ! $i!!erent reas ns( S-ML is n t the markup language ! the !uture&

+I,-RE 11.1 6espite several synta* err rs( ;etscape ;avigat r still ren$ere$ this "TML $ cument& Pro#$e%s &ith /,ML '! y u were t use S-ML t mark up We% $ cuments( y u w ul$ certainly have n tr u%le with !le*i%ility& A!ter all( S-ML is really a meta:language( r a language ! r $e!ining ther languages& 't pr vi$es a vast set ! !eatures ! r $evising $escripti n languages ! r $ cuments as sh rt as a single page r as l ng as several printe$ v lumes& 5ut therein lies the pr %lem& S-ML is s vast that it is verkill ! r m st kin$s ! We% pu%licati ns& The S-ML stan$ar$ stretches n ! r pages an$ pages( making it m re $i!!icult ! r ' 3 ntent pr vi$ers t mark up c ntent ' Er grammers t write parsers( %r wsers( an$ ther pr cessing pr grams S-ML has s many pti nal !eatures that it is =ust t cum%ers me ! r the nee$s ! We% pu%lishers& ,et it is much m re e*tensi%le an$ structure$#% th very $esira%le !eatures#than "TML& " w then can the We% pu%lishing w rl$ harness the %est qualities ! S-ML with ut all its high maintenance !eatures? XML* The 0est o1 0oth or$ds

The answer is XML& XML is a simpli!ie$ versi n ! S-ML that thr ws ut many ! the !eatures ! S-ML that =ust $ n)t apply t We% pu%lishing activities& The result is a meta:language that pr vi$es S-ML)s structure an$ !le*i%ility with ut all the c mple*ities& Speci!ically( XML is ' <*tensi%le& XML)s !le*i%ility c mes !r m its capa%ility t ena%le y u t make up y ur wn XML elements& This means that y u can intr $uce tags int XML as appr priate t y ur pu%lishing nee$s& ' E rta%le& The catch t %eing a%le t intr $uce y ur wn tags is that y u nee$ t %e a%le t c mmunicate the synta* ! th se tags t thers& + rtunately( it is !airly simple t pr $uce !iles that capture the rules ! y ur markup an$ ena%le thers t pr perly rea$ r pr cess y ur XML $ cuments& ' Structure$& One !eature that XML takes !r m S-ML is a rigi$ a$herence t a speci!ic structure& '! a $ cument is n t structure$ pr perly( it is n t c nsi$ere$ t %e XML& ' 6escriptive& XML elements are necessarily $iv rce$ !r m speci!ying h w c ntent is t %e presente$& Thus( the elements are !ree t $escri%e the meaning ! what they c ntain& This permits m re 1intelligent2 han$ling %y parsers an$ ther pr cessing pr grams& XML retains the %est !eatures ! S-ML with ut the intricacies ! S-ML( making it a much m re accessi%le language& XML als retains s me ! the g $ things a% ut "TML7 't is easy ! r We% $ cument auth rs t use an$ easy ! r pr grammers t write s !tware t ren$er XML c $e& The %alance ! this chapter is $e$icate$ t intr $ucing y u t the w rk that has %een $ ne s !ar in $evel ping an XML stan$ar$& A!ter an verview ! s me %asic c ncepts( y u will rea$ a% ut

elements an$ entities( the tw ma= r c mp nents ! XML& , u will then learn h w t set up $i!!erent kin$s ! links in XML $ cuments& +inally( y u will rea$ a% ut h w style sheets can %e use$ with XML !iles t speci!y presentati n an$ h w XML is alrea$y slate$ ! r use in a num%er ! specialty pu%lishing areas&
()TE* XML is a very y ung language& The XML I&C rec mmen$ati n was pu%lishe$ in early I44K( an$ nly n w are s !tware $evel pers m ving t war$ pr $ucing XML parsers an$ %r wsers& 3 ntent $evel pers have %egun t $evise $i!!erent applicati ns ! XML#! r e*ample( the Mathematical Markup Language /MathML0 is a speciali.e$ markup language $erive$ !r m XML& Many ther $isciplines have their wn XML:%ase$ markup languages in the w rks& XML is eventually e*pecte$ t supplant "TML as the 1m ther t ngue2 ! r We% pu%lishing( %ut this will n t happen vernight& When the W rl$ Wi$e We% 3 ns rtium /WF30 !inali.e$ the "TML B&C rec mmen$ati n earlier this year( it ann unce$ that the ne*t versi n ! "TML w ul$ %e the !irst imp rtant step t war$ migrating t XML& 't als sai$ that it w ul$ take appr *imately IK m nths t $evel p this transiti nal language( s y u have plenty ! time t learn the %asics ! XML an$ $evel p markup languages appr priate t y ur We% pu%lishing activities&

XML )2er2ie& 5e! re y u $ive int the speci!ics ! XML( it is help!ul t %e gr un$e$ in s me ! the %asic i$eas& +r m what y u have rea$ s !ar( y u un$erstan$ the m tivati n ! r creating XML& /"TML is t limite$J S-ML is t %r a$&0 'n a$$iti n( s me !un$amental c ncepts#i! mastere$ n w#will make it easier t rea$ the remaining secti ns ! this chapter& These c ncepts inclu$e ' ' ' ' The $i!!erent types ! XML markup 6 cument Type 6e!initi ns /6T6s0 Lali$ XML $ cuments Well:! rme$ XML $ cuments

The ne*t three secti ns e*amine these i$eas& T!pes o1 XML Mar3up +ive types ! markup e*ist in XML& S me ! these might %e !amiliar !r m y ur kn wle$ge ! "TML& '! y u kn w s me S-ML( all ! them sh ul$ ring a %ell& The great thing is that n single ne ! them is much har$er t learn than "TMLJ there! re( XML sh ul$ %e much m re accessi%le than S-ML& The !ive classes ! markup in XML are as ! ll ws7 ' <lements& XML elements $escri%e the meaning ! the te*t they c ntain& <lements typically ccur in pairs with a start tag an$ an en$ tag that encl se the te*t they mark up& 'nsi$e the start tag( a keyw r$ in$icates the meaning ! the markup& The en$ tag c ntains the same keyw r$ with a ! rwar$ slash /A0 in !r nt ! it& 5 th kin$s ! tag start with the less than sign /80 an$ en$ with the greater than sign /90&
()TE* Alth ugh su%tle $i!!erences e*ist %etween what c nstitutes an element an$ what c nstitutes a tag( the w r$s 1element2 an$ 1tag2 are s metimes use$ interchangea%ly& Speci!ically( 8A66R<SS9 is a tag( %ut the n ti n ! an 8A66R<SS9M 8AA66R<SS9 c ntainer captures the i$ea ! an element&

S me elements $ n t ccur in pairs& These elements are sai$ t %e empty& 5ecause it is imp rtant ! r parsers t kn w whether an element is empty( the tag ! r the element en$s with A9rather than 9& A line %reak element( ! r e*ample( might l k like
85RA9

rather than the 85R9 tag y u are use$ t in "TML& The a$$iti nal ! rwar$ slash makes it clear t parsers that they sh ul$ n t l k ! r a c rresp n$ing en$ tag&
()TE* The XML I&C rec mmen$ati n makes all wances ! r empty tags t have an en$ tag( pr vi$e$ it imme$iately ! ll ws the start tag& Un$er this pr visi n( y u c ul$ use <B%></B%> rather than <B%/> This a$$iti n makes XML a %it m re like "TML an$ will help ease the transiti n !r m auth ring "TML $ cuments t auth ring XML $ cuments&

S me elements take attributes that m $i!y r e*pan$ n the meaning they impart t the c ntent they c ntain& Attri%utes are set equal t values that must %e !!set %y qu tati n marks& , u c ul$ a$$ an attri%ute t the previ usly menti ne$ 85RA9 tag( ! r e*ample( t make it rea$
85R 3L<ARN2L<+T2A9

This makes it %reak t the !irst clear le!t margin& ' <ntities& <ntities in XML are very similar t entities in "TML& Recall that in "TML y u nee$ entities t represent reserve$ characters such as 8 r 9& The same i$ea applies in XML( an$ y u w ul$ use the same entities#OltJ an$ OgtJ#t ren$er these characters& XML als ena%les y u t use any Unic $e character y u wantJ thus( pr $ucing $ cuments in languages ther than <nglish is less ! a ch re& +inally( y u can $e!ine y ur wn entities right insi$e y ur XML c $e an$ re!erence them later n& ' XML entities can als resi$e e*ternally t the $ cument& , u can inc rp rate a separate XML !ile %y mapping it t an entity name an$ then re!erencing the entity in y ur main !ile& ' 3 mments& 3 mmenting y ur c $e is always pru$ent( an$ XML supp rts y u in c mmenting with the 8P:: an$ ::9 tags ! r encl sing c mments& These are the same tags y u use ! r c mments in % th "TML an$ S-ML& ' , u can place any te*t y u like %etween the 8P:: an$ ::9 tags( e*cept ! r the $ u%le hyphen c nstruct ::& This character sequence is reserve$( s it can help t $en te the c mment& ' Er cessing instructi ns& Er cessing instructi ns /E's0 ena%le y u t em%e$ in! rmati n t %e passe$ t an applicati n right in y ur XML $ cument& All E's have the ! ll wing synta*7
8?name $ata?9

The name( r PI target, sh ul$ %e ne that an applicati n will rec gni.e& , u can give the target any name y u like( %ut targets %eginning with 1XML2 are reserve$ ! r stan$ar$i.ati n purp ses& The $ata c mp nent ! the E' can %e anything that the pr cessing applicati n un$erstan$s& There! re( it is imp rtant ! r pr cessing applicati ns t act nly n E's wh se targets they rec gni.e& ' 'gn re$ secti ns& S metimes it is necessary t pass characters that are XML reserve$ characters& 'n these cases( y u can $e!ine a secti n that will %e ign re$ %y the XML parser an$ %e passe$ t a pr cessing applicati n& A g $ e*ample ! this is mathematical c $e( which is likely t c ntain greater than /90 r less than /80 signs& A parser w ul$ n rmally treat these characters as parts ! a start r en$ tag( %ut i! y u put them int an ign re$ secti n( like this7
8PQ36ATAQ

B 8 F is +ALS<& RR9

the e*pressi n with the less than sign passes t the applicati n& All ign re$ secti ns start with 8PQ36ATAQ an$ en$ with RR9& , u can put any te*t y u want %etween these c ntainers e*cept ! r the RR9 c m%inati n&
()TE* 3 mments ! un$ in an ign re$ secti n get passe$ t the pr cessing applicati n as well&

With a sense ! what the ma= r types ! markup are( y u c ul$ pr %a%ly get starte$ with s me XML y ursel!& , u c ul$ mark up a letter( ! r e*ample( as ! ll ws7
<! TT %> <DAT A!&'N#$%&')T$> "e3tem-er 5;< 2;;= </DAT > <&N"&D ADD% ""> Trans 6nion Cor3oration<B%/> Consumer Disclosure Center<B%/> P7O7 Bo: >;/<B%/> "3ring4iel.< PA 2;/?@A/>;/<B%/> </&N"&D ADD% ""> <"A!6TAT&ON> Dear Customer %elations %e3resentati8eB </"A!6TAT&ON> <BOD,> <P A!&'N#$C6"T&1,$> Please sen. me a co3y o4 my cre.it 4ile7 nclose. 3lease 4in. a 3age o4 3ersonal .ata an. a checD 4or E=7// 4or your ser8ices7 </P> <P A!&'N#$C6"T&1,$> ,ou may sen. the re3ort to the a..ress in.icate. on the 3ersonal .ata 3age7 </P> <P> ThanD you 4or your assistance7 </P> </BOD,> <C!O"&N'> Fery truly yours< </C!O"&N'> <"&'NAT6% > *ary Consumer </"&'NAT6% > </! TT %>

5ecause y u are pr %a%ly !amiliar with the structure ! a %usiness letter( the prece$ing markup makes sense& ; te h w the elements $escri%e the nature ! the te*t they c ntain( rather than h w it sh ul$ %e presente$& 'n !act( the nly re!erence t presentati n y u see is the AL'-; attri%ute in the 86AT<9 an$ 8E9 tags& ; te als that the elements use$ are n t part ! any speci!icati n#they were ma$e up t $escri%e each part ! the letter& The !ree$ m t make up y ur wn elements is ne ! XML)s chie! strengths& What happens( h wever( when y u try t share ne ! y ur XML $ cuments with s me ne else? , u un$erstan$ what all the markup means( ! c urse( %ut i! y u share with thers wh $ n t un$erstan$ it( their XML parsers may n t %e a%le t han$le y ur $ cument c rrectly& + rtunately( y u can share the XML structures y u $evise with thers& 5y writing a 6 cument Type 6e!initi n /6T60( y u speci!y y ur XML elements( their attri%utes( an$ their synta*& Then y u can re!erence y ur 6T6 at the t p ! y ur XML $ cument s that any parser

kn ws where t !in$ the 6T6 !ile& A!ter the parser has the 6T6( it 1un$erstan$s2 y ur $ cument as well as y u $ & 3 mp sing a 6T6 is the su%=ect ! the ne*t secti n& 4ocu%ent T!pe 4e1initions 54T4s6 A DTD is a set ! rules that speci!ies h w t use XML markup& 't c ntains specs ! r each element( inclu$ing what the element)s attri%utes are( what values the attri%utes can take n( an$ what elements can %e c ntaine$ in thers& A$$iti nally( y u can $e!ine entities in the 6T6& , u can $e!ine entities right in the 6T6 r in re!erence c $e in an e*ternal !ile& + r the %usiness letter e*ample in the prece$ing secti n( y u might c mp se a 6T6 that l ks like this7
<! ! * NT letter G.ate< insi.ea..ress< salutation< -o.y< closing< signatureHI> <! ! * NT .ate GJPCDATAI> <!ATT!&"T .ate align Gle4tKrightI Lle4t$> <! ! * NT insi.ea..ress GJPCDATA K -rMI> <! ! * NT -r *PT,> <! ! * NT salutation GJPCDATAI> <! ! * NT -o.y G3+I> <! ! * NT 3 GJPCDATAI> <!ATT!&"T 3 align Gle4tKNusti4yKrightI Lle4t$> <! ! * NT closing GJPCDATAI> <! ! * NT signature GJPCDATAI>

This c $e may n t %e as clear as the markup it speci!ies( s here is a line:%y:line $escripti n ! what the 6T6 says7 ' A L<TT<R has e*actly ne 6AT<( ne ';S'6<A66R<SS( ne SALUTAT'O;( ne 5O6,( ne 3LOS';-( an$ an pti nal S'-;ATUR<& ' A 6AT< c ntains nly te*t& ' The 6AT< element has an attri%ute calle$ AL'-; that can take n values ! L<+T an$ R'-"T& 'n the a%sence ! a speci!icati n ! r AL'-;( its value sh ul$ %e taken t %e equal t L<+T& ' An 8';S'6<A66R<SS9 c ntains te*t an$ .er r m re 85RA9 elements& ' The 85RA9 element is empty /that is( it has n en$ tag0& ' A 8SALUTAT'O;9 c ntains nly te*t& ' The 85O6,9 c mprises ne r m re 8E9 elements& ' The 8E9 element c ntains nly te*t& ' The 8E9 element als has an AL'-; attri%ute that can equal L<+T( SUST'+,( r R'-"T& 'ts $e!ault value is taken t %e L<+T& ' The 83LOS';-9 element c ntains nly te*t& ' The 8S'-;ATUR<9 element c ntains nly te*t& Sust %y kn wing these rules( any XML parser c ul$ pr perly pr cess y ur $ cument& 'n a$$iti n t %eing use!ul ! r XML parsers an$ %r wsers( a 6T6 is use!ul in a !ew ther situati ns7 ' XML auth ring t ls use 6T6s t vali$ate the c $e y u write& '! the synta* in y ur XML $ cument is inc rrect( the pr gram can $etect an$ !lag it ! r y u& As the ne*t secti n e*plains( the pr gram sh ul$ n t even ena%le y u t save the $ cument unless it c n! rms t a 6T6& ' An XML %r wser can)t kn w the $e!ault values ! any attri%utes with ut a 6T6&

' Sust as with "TML( XML ign res e*tra whitespace characters /spaces( carriage returns( ta%s0 %ey n$ a single space& Speci!ically( i! an element)s c ntent m $el is mixed /meaning it can %e % th te*t an$ ther elements0( whitespace within the element is taken t %e signi!icant& <lements that c ntain nly ther elements are sai$ t have element contentJ whitespace in these elements is ign re$& M st imp rtantly( 6T6s ena%le y u t pu%lish y ur $ cuments ! r c nsumpti n %y thers& T acc mplish this( h wever( y u must inclu$e instructi ns in y ur $ cuments that tell an XML pr cessing pr gram h w t !in$ y ur 6T6& A$$ing a simple 8P6O3T,E<9 element at the start ! y ur XML !ile takes care ! this& + r the letter e*ample( y u might re!erence its 6T6 as ! ll ws7
<!DOCT,P ! TT % ","T * Lhtt3B/www7ser8er7com/DTDs/letter7.t.$> <! TT %> <DAT A!&'N#$%&')T$> "e3tem-er 5;< 2;;= </DAT > <&N"&D ADD% ""> 777 </! TT %>

The !irst line in the c $e $irects the XML pr cess r t the 6T6 at http7AAwww&server&c mA6T6sAletter&$t$& The pr cess r can then $ wnl a$ the 6T6 an$ use it t check the $ cument ! r appr priate synta* an$ t $etermine $e!ault attri%ute values& 7a$id and e$$8+or%ed XML 4ocu%ents

+ r all the value a 6T6 pr vi$es( y u may %e surprise$ t learn that 6T6s are n t a%s lutely necessary& '! an XML $ cument c n! rms t a !ew key rules( a parser sh ul$ still %e capa%le ! han$ling it& Speci!ically( a $ cument is sai$ t %e well !ormed i! ' 't c ntains ne r m re elements& ' The $ cument c n! rms t the grammar put ! rwar$ in the XML speci!icati n& ' One element calle$ the root or document element is present wh se start an$ en$ tags are n t c ntaine$ %y any ther element& The 8L<TT<R9 element w ul$ %e the r t element ! r the letter e*ample& ' All ther n n:empty elements are pr perly neste$& ' All attri%ute values are c ntaine$ %y qu tati n marks& ' All entities have either %een $eclare$ in the 6T6 r( i! n 6T6 is speci!ie$( are ne ! the ! ll wing reserve$ entities7 OampJ( OltJ( OgtJ( Oap sJ( an$ Oqu tJ& <ven in the a%sence ! a 6T6( an XML parser sh ul$ c rrectly parse a well:! rme$ $ cument& This means that the parser can %uil$ the $ cument tree /the l gical structure that the parser creates as it pr cesses the $ cument0( %ut it cann t assess the pr per use ! the elements& The key thing t remem%er a% ut well:! rme$ $ cuments is this7 '! it is n t well ! rme$( it is n t XML& A $ cument that is n t well ! rme$ will %e summarily re=ecte$ %y any XML parser& This seemingly rigi$ appr ach has tw imp rtant a$vantages7 ' 't ensures that XML never 1%reaks2 a %r wser the way e*ten$e$ "TML tags can& '! a $ cument is well ! rme$( an XML %r wser is guarantee$ t %e capa%le ! ren$ering it& '! a $ cument isn)t well ! rme$( the %r wser =ust ign res it&

' 't ! rces XML auth rs t get int g $ c $ing ha%its( as pp se$ t the sl ppy ha%its that have c me t plague "TML $ cuments& 5ecause the rules ! %eing well:! rme$ are well esta%lishe$( any XML e$iting pr gram sh ul$ %e capa%le ! checking an auth r)s w rk t $etermine whether it is well ! rme$ %e! re saving& '! a 6T6 is speci!ie$ ! r a well:! rme$ $ cument an$ the $ cument c n! rms t the 6T6( the $ cument is sai$ t %e "alid& Lali$ity is a str nger requirement than %eing well:! rme$& " wever( %ecause vali$ity implies the presence ! a 6T6( it is certainly the pre!erre$ state ! the tw & The primary %ene!it ! having a vali$ $ cument is that it is wi$ely pu%lisha%le& A vali$ $ cument has t have a 6T6( an$ i! y u make that 6T6 availa%le with the $ cument( any XML pr cessing pr gram can use the 6T6 t !acilitate the parsing an$ ren$ering ! the $ cument& 5ecause the 6T6 ! rmally $e!ines the $ cument( it als %ec mes easier t %ring ther !uncti nality t %ear n the $ cument( such as search engines( style sheets( n nvisual %r wsers( an$ printing applicati ns& Lin3in9 &ith XML The !irst phase ! the WF3)s r ll ut ! XML was issuing the rec mmen$ati n ! r %asic XML grammar& That rec mmen$ati n is really =ust a set ! rules ! r h w elements( entities( pr cessing instructi ns( an$ s n must %e structure$ ! r a $ cument t %e c nsi$ere$ an XML $ cument& The $ra!t $ es n t speci!y any particular elements %ecause XML auth rs are !ree t create their wn& The same is true ! r entities( e*cept ! r the !ive reserve$ entity characters /OltJ( OgtJ( OampJ( Oqu tJ( Oap sJ0& Alth ugh the $ra!t may seem vague( remem%er that( in a sense( it is supp se$ t %e& The 1e*tensi%ility2 part ! XML c mes !r m the capa%ility t ! rm y ur wn sets ! elements an$ entities acc r$ing t y ur nee$s& One imp rtant i$ea that the rec mmen$ati n $ es n t a$$ress is that ! linking $ cuments& '! y u are !amiliar with "TML( y u kn w that y u use an 8A9 element with the "R<+ attri%ute t link te*t r graphics t an ther $ cument& 5ut %ecause n speci!ic elements e*ist in XML( y u may %e w n$ering h w XML $ cuments get linke$ t gether& The answer lies in the sec n$ phase ! the XML r ll ut#the $ra!t pr p sal ! r XML linking using the XML Linking Language /XLink0 an$ the XML E inter Language /XE inter0& 'n keeping with the 1e*tensi%le an$ !le*i%le2 phil s phy inherent in XML( XLink an$ XE inter call ! r m re than the tra$iti nal( uni$irecti nal linking y u get with "TML& 'nstea$( y u can $ e*ten$e$ linking that all ws ! r multi$irecti nal links r links t special kin$s ! in! rmati n& The ne*t !ew secti ns l k at what is p ssi%le in linking XML $ cuments&
()TE* The XLink pr p sal is c nstantly ev lving( s %e sure t check the WF3 site at http7AAwww&wF& rgATRAW6:*link ! r the m st recent changes t the pr p sal&

XLin3 The WF3 pu%lishe$ a pr p se$ XLink I&C stan$ar$ in March I44K& That pr p sal put ! rth the n ti n ! tw classes ! links7 ' Simple links#Simple links are ne:$irecti nal links !r m ne res urce t an ther( similar t h w y u use the 8A9 element in "TML& Simple links are usually inline( which means that the c ntent ! the element $escri%ing the link serves as a res urce ! the link& The 8A9 element( ! r e*ample( pr $uces inline links %ecause its c ntents /the "R<+ attri%ute0 speci!y the link)s res urce /the $ cument the link p ints t 0&

' <*ten$e$ links#<*ten$e$ links are links that can %e multi$irecti nal& A$$iti nally( y u can use the n ti n ! e*ten$e$ links t $e!ine what is kn wn as an e*ten$e$ link gr up /$escri%e$ later in the chapter0& , u are !ree t make up whatever element y u like t speci!y an XML link( %ut that link must c ntain the XML7L';? attri%ute( which is reserve$ s that parsers an$ %r wsers have s me way ! kn wing that the element is $e!ining a link& T create links( y u usually set XML7L';? t ne ! tw values7 S'MEL< r <XT<;6<6& , u can als use ther values ! XML7L';? when $e!ining e*ten$e$ links& The ne*t tw secti ns review the speci!ics ! each type ! link& /i%p$e Lin3s The simple XML link is very much like the link y u get with the 8A9 element in "TML& 5ecause it is up t the XML auth r as t what t name an element( n speci!ic element name is reserve$ ! r use when linking& + r the purp ses ! this secti n( the simple linking element is 8S'MEL';?9& , u are welc me t call the simple link element whatever y u w ul$ like in y ur wn $ cuments& What sets simple linking apart !r m %asic linking in "TML is the much greater num%er ! attri%utes that a simple link element can take& Ta%le II&I summari.es these attri%utes&
Ta#$e 11.1 Attri#utes 1or a /i%p$e Lin3 E$e%ent Attri#ute
A3TUAT<N2AUTOTUS<R2

Purpose

Speci!ies what event sh ul$ trigger the traversal ! the link 5<"AL'OR Er vi$es m re $etail a% ut h w the traversal sh ul$ ccur 3O;T<;T:ROL< 6escri%es the meaning ! the c ntent in the $ cument y u)re linking t 3O;T<;T:T'TL< Er vi$es a title ! r the linke$ c ntent that can %e $isplaye$ t the user "R<+ Speci!ies the URL ! the $ cument y u)re linking t ';L';<N2TRU<T+ALS<2 Says whether the link is inline ROL< 6escri%es the meaning ! the link S"OWN2<M5<6TR<ELA3<T;<W2 Tells the pr cessing applicati n h w t $isplay the in! rmati n in the linke$ $ cument T'TL< Er vi$es a title ! r the link that can %e $isplaye$ t the user XML7L';? Speci!ies what kin$ ! XML link the element supp rts

Many ! these attri%utes w ul$ strike even a veteran "TML auth r as strangeJ thus( a !ew a$$iti nal w r$s ! e*planati n are pr %a%ly in r$er& The A3TUAT< attri%ute tells the pr cessing applicati n when the link sh ul$ %e traverse$& '! it is set t AUTO( the link is traverse$ when it is enc untere$& A3TUAT<N2US<R2 means that the link sh ul$ n t %e traverse$ until the user e*plicitly requests it& A!ter the link traversal %egins( the pr cessing applicati n can get m re $etails a% ut h w t carry ut the traversal !r m the 5<"AL'OR attri%ute& The S"OW attri%ute tells the pr cessing applicati n h w t $isplay the linke$ c ntent with respect t the c ntent it is currently $isplaying& Setting S"OW t R<ELA3< tells the applicati n t verwrite the current c ntent with the linke$ c ntent& A S"OW value ! <M5<6 means t em%e$ the linke$ c ntent insi$e the current c ntent& +inally( setting S"OW t ;<W $irects the applicati n t $isplay the linke$ c ntent in a new c nte*t that $ es n t change the nature ! the

$isplay ! the current c ntent /much like a We% %r wser launching a new instance t $isplay a page instea$ ! replacing the l a$e$ page0& '! a link is an inline link /as m st simple links are0( it is appr priate t use the 3O;T<;T: ROL< an$ 3O;T<;T:T'TL< attri%utes t pr vi$e meaning an$ title in! rmati n ! r the c ntent& '! the link is ut: !:line( y u can still speci!y 3O;T<;T:ROL< an$ 3O;T<;T:T'TL< attri%utes( %ut they have n meaning in that c nte*t& Recall that ut: !:line links are use!ul ! r creating multi$irecti nal links( %ut they have meaning nly in the c nte*t ! a link gr up( which tells a pr cessing applicati n where t l k ! r linking in! rmati n&
()TE* Attri%ute names that start with XML are reserve$ ! r the !urther stan$ar$i.ati n ! the linking speci!icati n& There! re( y u sh ul$ n t intr $uce an attri%ute name that starts with the string 1XML2 in any ! y ur XML markup&

When setting up y ur link element( y u can speci!y s me $e!ault attri%ute values in y ur 6T6 that eliminate the nee$ ! r a l t ! e*tra typing& , u kn w that 8S'MEL';?9 is inten$e$ t %e a S'MEL<link( ! r e*ample( an$ that it will m st likely %e inline( that users will pr %a%ly want c ntr l ver traversal ! the link( an$ that the linke$ c ntent sh ul$ replace e*isting c ntent& , u can e*press all this in a 6T6 as ! ll ws7
<! ! * NT sim3linD <!ATT!&"T sim3linD ACT6AT B )AF&O% CONT NTA%O! CONT NTAT&T! )% 1 &N!&N %O! ")OW T&T! P*!B!&N+ > AN,> GA6TOK6" %I CDATA CDATA CDATA CDATA GT%6 K1A!" I CDATA G% P!AC K *B DKN WI CDATA CDATA L6" %$ J&*P!& D J&*P!& D J&*P!& D J% O6&% D LT%6 $ J&*P!& D L% P!AC $ J&*P!& D J1&P D L"&*P! $

With this 6T6( y u c ul$ speci!y a link as simple as


<"&*P!&N+ )% 1#$linDe.Q.oc7:ml$>elementQcontent</"&*P!&N+>

Lalues ! XML7L';?N2S'MEL<2( A3TUAT<N2US<R2( ';L';<N2TRU<2( an$ S"OWN2R<ELA3<2 are un$erst $ !r m the 6T6& E:tended Lin3s <*ten$e$ links $i!!er !r m simple links in that they can p int t any num%er ! res urces that may r may n t %e c :l cate$ with the $ cument in which the link is ! un$& The result is a 1multilinke$2 link that can take a user t ne ! many places& Tw types ! elements are nee$e$ t speci!y an e*ten$e$ link& The !irst is ne t c ntain link te*t ! r each in$ivi$ual linke$ res urce( an$ the sec n$ is ne t c ntain the elements that $e!ine the linke$ res urces& As state$ earlier( y u can name XML elements in whatever way y u ch se& + r this $iscussi n( h wever( 8<XTL';?9 is the c ntainer element ! r the elements that speci!y in$ivi$ual res urces( an$ 8LO3ATOR9 is the element that c ntains link te*t ! r each res urce& What that yiel$s ! r a general e*ten$e$ link synta* is
< PT!&N+ 777> <!OCATO% 777>!inD te:t</!OCATO%> <!OCATO% 777>!inD te:t</!OCATO%> 777

<!OCATO% 777>!inD te:t</!OCATO%> </ PT!&N+>

<ach ! these elements has a num%er ! attri%utes( %ut they are the same as th se use$ with the 8S'MEL';?9 element t $e!ine simple links& 8<XTL';?9 takes the ! ll wing attri%utes7 ' ' ' ' ' ' ' ' '
A3TUAT< 5<"AL'OR 3O;T<;T:ROL< 3O;T<;T:T'TL< ';L';< ROL< S"OW T'TL< XML7L';?

+ r the 8<XTL';?9 element( y u sh ul$ set the XML7L';? attri%ute equal t <XT<;6<6 r assign a $e!ault value ! <XT<;6<6 in the 6T6& Otherwise( values an$ !uncti ns ! the attri%utes are the same as speci!ie$ in Ta%le II&I& ; te that 8<XTL';?9 $ es n t take the "R<+ attri%ute& This is %ecause it c ntains the p inters t in$ivi$ual res urces instea$ ! p inting t s mething itsel!& The 8LO3ATOR9 element takes these attri%utes7 ' ' ' ' ' ' '
A3TUAT< 5<"AL'OR "R<+ ROL< S"OW T'TL< XML7L';?

8LO3ATOR9 elements $ n t p int t linke$ res urces& 5ecause ! this( the "R<+ attri%ute is necessary& , u sh ul$ set the XML7L';? attri%ute in a 8LO3ATOR9 element t LO3ATOR&

5ey n$ that( the attri%utes are the same as in Ta%le II&I& 5y putting it all t gether an$ inclu$ing a 6T6 that speci!ies $e!ault attri%ute values( y u might see a sample e*ten$e$ link that l ks like this7
,ou can 4in. a lot o4 goo. online re4erences a-out < PT!&N+> <!OCATO% P*!B!&N+#$!OCATO%$ )% 1#$htt3B//www7w>7org/P*!/$>W>C P*! Page</!OCATO%> <!OCATO% P*!B!&N+#$!OCATO%$ )% 1#$htt3B//www7ucc7ie/:ml/$>P*! 1AO</!OCATO%> <!OCATO% P*!B!&N+#$!OCATO%$ )% 1#$htt3B//.e8elo3er7netsca3e7com/news/8iewsource/ -rayQ:ml7html$>Beyon. )T*!B P*! an. Automate. We- Processing -y Tim Bray</!OCATO%> P*! </ PT!&N+>

'n a %r wser( the te*t 1XML2 w ul$ %e hyperlinke$& " wever( when a user clicks the te*t( the %r wser nee$s t $ s mething t present the multiple linking pti ns& This might take the ! rm ! a p p:up menu that lists WF3 XML Eage( XML +A@( an$ 15ey n$ "TML7 XML an$

Aut mate$ We% Er cessing2 %y Tim 5ray& Users c ul$ then ch pti ns&

se !r m am ng these three

E:tended Lin3 ,roups With the p ssi%ility ! e*ten$e$( ut: !:line links( a pr cessing applicati n may !in$ it necessary t pr cess a num%er ! separate !iles t $etermine all the links an$ their res urces& T !acilitate this pr cessing( XML supp rts the n ti n ! an extended link group#a l gical gr uping ! linke$ $ cuments& The gr up is $e!ine$ %y an$ c ntaine$ in a gr uping element( an$ each $ cument in the gr up is speci!ie$ %y an empty $ cument element& 3alling the gr uping an$ $ cument elements 8XL';?-ROUE9 an$ 86O3UM<;T9( respectively( y u c ul$ set up the ! ll wing e*ten$e$ link gr up7
<P!&N+'%O6P P*!B!&N+#$'%O6P$ <DOC6* NT P*!B!&N+#$DOC6* <DOC6* NT P*!B!&N+#$DOC6* <DOC6* NT P*!B!&N+#$DOC6* 777 <DOC6* NT P*!B!&N+#$DOC6* </P!&N+'%O6P> "T P"#>> NT$ )% 1#$.oc27:ml$/> NT$ )% 1#$.oc57:ml$/> NT$ )% 1#$.oc>7:ml$/> NT$ )% 1#$.ocn7:ml$/>

The ST<ES attri%ute ! the 8XL';?-ROUE9 elements rec gni.es that the linke$ $ cuments may inclu$e e*ten$e$ link gr ups themselves an$ places a limit n h w many $ cument levels $eep the pr cessing applicati n sh ul$ g when pr cessing the e*ten$e$ gr up& The "R<+ attri%ute ! the 86O3UM<;TA9 element gives the URL ! each linke$ $ cument&
()TE* Lalues ! the XML7L';? attri%ute ! r the 8XL';?-ROUE9 element an$ the 86O3UM<;TA9 element are -ROUE an$ 6O3UM<;T( respectively& ; te that these values c ul$ have %een set up as $e!aults in the 6T6&

XPoint 5 rr wing !r m the Te*t <nc $ing 'nitiative /T<'0#a pr =ect wh se %=ective is t i$enti!y stan$ar$s an$ gui$elines ! r the electr nic pu%licati n ! sch larly w rk#XML als inclu$es the n ti n ! extended pointers, r XPointers& The WF3 $ cument that puts ! rwar$ the n ti n ! XE inters is calle$ the XML E inter Language r XE int& XE inters %asically ena%le y u t link t a p siti n in a $ cument)s parsing tree /the l gical structure the parser uses t represent the $ cument0& This saves y u !r m having t set up name$ anch rs the same as y u $ in an "TML $ cument& 'n the %usiness letter e*ample( y u c ul$ link t
chil.G2<-o.yI G>I

This w ul$ re!er t the thir$ chil$ ! the !irst /an$ nly0 5O6, element in the letter& Links can als p int t a span ! the $ cument tree& + r e*ample( the c $e
chil.G><3I77chil.G0<3I

selects the thir$( ! urth( an$ !i!th 8E9 elements ! the letter& A p inter that spans multiple element in the $ cument tree is calle$ spanning XPointer& XE inters will %e m st use!ul t pr grammers writing applicati ns that parse r $isplay XML $ cuments %ecause they pr vi$e a c nvenient way t re!erence the $ cument)s internal

structure& + r m re in! rmati n a% ut using XE inters( c nsult the WF3 site at http7AAwww&wF& rgATRAW6:*ptr& -sin9 /t!$e /heets &ith XML One ! the imp rtant p ints ma$e at the start ! this chapter was that XML elements $ n t speci!y h w c ntent is presente$& 'nstea$( an XML %r wser sh ul$ use a style s#eet t $etermine h w c ntent in each element sh ul$ %e $isplaye$& The $elivery ! a sec n$ $ra!t speci!icati n ! r XML style sheet language /XSL0 I&C is e*pecte$ sh rtly a!ter this % k is pu%lishe$J thus( at the time ! this writing( the e*act $etails ! h w t implement XML style sheets are n t kn wn& " wever( s me $ cuments are availa%le thr ugh the WF3 that give a !lav r ! r what XSL might ultimately %e like7 the $ra!t XSL speci!icati n an$ the XSL Requirements Summary& The 4ra1t X/L /peci1ication The !irst is the $ra!t XSL speci!icati n su%mitte$ t the WF3 in August I44U& Auth rs ! the $ra!t e*pect that XML $ cument auth rs will %e a%le t use the 3asca$ing Style Sheet /3SS0 stan$ar$ ! r speci!ying presentati n attri%utes ! r simple XML $ cuments& 6 cuments requiring m re c mple* ! rmatting w ul$ use XSL& D /ee 1Style Sheets(2 p. 261& The XSL $ra!t spec is %ase$ largely n the 6 cument Style Semantics an$ Speci!icati n Language /6SSSL0( an 'SO stan$ar$ ! r speci!ying h w a $ cument is t %e ! rmatte$& 't c nsists ! tw parts7 a trans! rmati n language( which is use$ t apply structural trans! rmati ns t S-ML !ilesJ an$ a style language( which is use$ t pr vi$e ! rmatting instructi ns& T gether( these languages take raw S-ML c $e an$ prepare it ! r $isplay thr ugh a %r wser& The XSL W rking -r up is a$apting 6SSSL t w rk with XML& A!ter their w rk is c mplete( XML auth rs will have a way t speci!y presentati n ! r their $ cuments the same as they use a 6T6 t speci!y synta*& The X/L Re;uire%ents /u%%ar! The WF3)s XSL W rking -r up has put ! rwar$ a num%er ! requirements that the XSL stan$ar$ sh ul$ a$$ress& This requirements summary is s mething like a 1wish list2 given t the $esigners ! XSL t gui$e their w rk& 't is n t e*pecte$ that the !irst $ra!t ! XSL will a$$ress all the requirements( %ut %y having all the requirements ut n the ta%le !r m the start( $esigners can create XSL in such a way that it is easier t implement the !ull set ! requirements in !uture revisi ns& The Summary places the requirements int several l gical gr upings( inclu$ing7 ' ' ' ' ' ' ' ' -eneral ! rmatting issues 3 lumns( !l ats( keeps( an$ s + nts 3 l rs Math 'nternati nali.ati n Scripting 'nteractivity n

' ' ' '

Accessi%ility <*tensi%ility Eackaging Meta:in! rmati n

The -eneral ! rmatting issues secti n( ! r e*ample( c ntains speci!ic requirements ! r c ntent p siti ning( alignment( animati n( cr ss:re!erences( $r p caps( hea$ers( hyphenati n( in$enting( =usti!icati n( kerning( lea$ing( margins( run:ar un$s /whitespace ar un$ an %=ect0( ta%les( an$ tiling#all %asic attri%utes ! m st We% $ cuments&
()TE* , u can l k up speci!ic requirements un$er each ! the gr upings liste$ previ usly %y $irecting y ur %r wser t http7AAwww&wF& rgATRAW6:XSLReq&

App$ications At this p int( y u may %e w n$ering h w y u might %e a%le t use XML in y ur w rk as a We% c ntent $evel per& XML)s %est an$ highest use is ! r the creati n ! speciali.e$ markup languages& There! re( i! y u want t $etermine h w y u can use XML( think a% ut the c ntent y u are pu%lishing an$ what special nee$s y u have %ase$ n the nature ! the c ntent& Eerhaps y ur c ntent is relate$ t a speci!ic scienti!ic $iscipline( r y ur $ cuments may have an unusual structure t them& , u can capture these characteristics %y using XML t $e!ine a cust mi.e$ markup language that supp rts them& '! y u take it a step !urther an$ $evel p a 6T6 ! r y ur XML applicati n( y u pen the p ssi%ilities ! making y ur $ cuments m re easily ! rmatte$ an$ searche$& This is %ecause the applicati ns that per! rm these tasks can use the 6T6 t teach themselves the rules y u create ! r marking up the c ntent& 6espite XML)s newness( it is alrea$y %eing use$ %y s me c mpanies as the ! un$ati n ! r speciali.e$ markup languages& S me ! these applicati ns inclu$e ' Synchr ni.e$ Multime$ia 'ntegrati n Language /SM'L0#SM'L is inten$e$ ! r auth ring presentati ns ! multime$ia c ntent& The premise %ehin$ SM'L is t pr vi$e a simple( te*t:%ase$ language ! r creating multime$ia presentati ns an$ t all w ! r c ntr lling the r$er ! presentati n an$ any special e!!ects within the presentati n /c ntr l panels( sl w m ti n( hyperlinks( an$ s n0& ' 3hannel 6e!initi n + rmat /36+0#Micr s !t)s visi n ! r push techn l gy n the We% is supp rte$ %y 36+& We% site a$ministrat rs can turn all r part ! their sites int 1We%casting channels2 %y %uil$ing a 36+ !ile that $rives the channel& XML is use!ul in creating 36+ %ecause it was necessary t create elements t $e!ine the channel an$ the sche$ule ! r up$ating the channel c ntent& ' /ee 136+ an$ Active 6eskt p 3 mp nents(2 p. <15& ' Mathematical Markup Language /MML0#Mathematics is a $iscipline with many unique pu%lishing requirements( especially when it c mes t special characters such as perat r sym% ls r -reek letters& MML ena%les $ cuments with heavy mathematical c ntent t %e ren$ere$ n the We%& ' 3hemical Markup Language /3ML0#Eu%licati ns in chemistry nee$ t %e capa%le ! e*pressing $escripti ns ! chemical ! rmulas( equati ns( an$ m lecule structures& 3ML supp rts chemists wh want t pu%lish their research t the 'nternet&

The prece$ing list ! applicati ns c vers a $iverse range ! c ntent& ; ne ! these areas c ul$ have %een han$le$ %y "TML( yet XML has the !le*i%ility t $e!ine a electr nic pu%licati n markup language ! r each ne& XML /o1t&are ; w that XML is m ving t war$ having a relatively sta%le stan$ar$ t gr w !r m( m re an$ m re XML:relate$ s !tware is %ec ming availa%le& These pr grams ten$ t !all int ne ! three classes7 ' XML %r wsers ' XML parsersAvali$at rs ' XML e$it rs 5ecause the XML style sheet speci!icati n has yet t c me int sharp ! cus( !ew XML %r wsers e*ist at the m mentJ th se that $ e*ist are !airly primitive in their presentati n capa%ilities& A!ter XSL is n a !irmer ! un$ati n( y u can e*pect XML %r wsers t %e m re a$ept at presenting in! rmati n marke$ up with XML& 't)s a !airly easy matter t pr $uce an XML parserAvali$at r %ecause the rules ! r what c mp ses a vali$ XML $ cument are rigi$ly $e!ine$& Such a pr gram w ul$ !irst nee$ t check whether the $ cument is well ! rme$& '! it is( the ne*t step is t scan the $ cument)s 6T6 an$ check t see whether the $ cument c n! rms t the rules in the 6T6& '! it $ es( then it is a vali$ $ cument& +inally( m re an$ m re XML e$it rs are emerging& These are als !airly straight! rwar$ t pr gram %ecause all an e$it r has t $ is give users an envir nment in which they can create their wn tags& One e$it r that has receive$ !av ra%le press is XML 8ERO9 !r m Lervet L gic /http7AAwww&vervet&c mA0& A!ter y u create a r t element ! r y ur XML $ cument( XML 8ERO9 ena%les y u t $e!ine ther elements an$ ass ciate attri%utes with th se elements& Any element y u $e!ine is liste$ in the !l ating <lements % * /see +igure II&V0&

+I,-RE 11.2 XML 8ERO9 gives y u an envir nment ! r $e!ining y ur wn XML elements an$ their attri%utes& A!ter y u have s me elements $e!ine$( y u can %egin t %uil$ y ur $ cument tree in the le!t si$e ! the XML 8ERO9 win$ w& , u insert an element !r m the <lements % * int the tree %y clicking the element t select it an$ then clicking the 'nsert %utt n at the % tt m ! the % *& The tree is sh wn in a hierarchical structure#much the same way ! l$ers an$ !iles are $isplaye$ in the Win$ ws <*pl rer /re!er t +igure II&V0& A!ter y u)ve %uilt up a $ cument tree( y u can ask XML 8ERO9 t generate the c rresp n$ing XML c $e& 5y ch sing the Liew XML pti n !r m the T ls menu( y u)ll get a p p:up % * c ntaining the XML that w ul$ %e parse$ t pr $uce the $ cument tree y u)ve %uilt /re!er t +igure II&V0& When y u save the $ cument( XML 8ERO9 will save the c $e y u see $isplaye$ in the p p:up % *& Other use!ul !eatures ! XML 8ERO9 inclu$e

' 6T6 Ass ciati n#XML 8ERO9 w n)t help y u t write a 6T6 ! r y ur $ cument( %ut a!ter y u)ve written ne( y u can ass ciate it with y ur $ cument& XML 8ERO9 will insert the appr priate tag int y ur $ cument( linking it t the 6T6 y u speci!y& ' 6 cument vali$ati n#'! y u)ve ass ciate$ a 6T6 with a $ cument( y u can use the XML 8ERO9 vali$at r t test the $ cument ! r vali$ity& ' <ntity palette#A !l ating palette is availa%le ! r inserting any entities y u $e!ine& 3h se Opti ns( Sh w <ntity Ealette t activate the palette& XML 8ERO9 retails ! r WIB4&4X& , u can $ wnl a$ a $em versi n ! XML 8ERO9 !r m the Lervet L gic We% site at http7AAwww&vervet&c mA&
()TE* As m re pu%lic XML:relate$ s !tware %ec mes availa%le( y u can !in$ it p ste$ n R %in 3 ver)s Eu%lic S-MLAXML S !tware page at http7AAwww&sil& rgAsgmlApu%licSW&html&

Re1erences XML is in the early stages ! $evel pment an$ is sure t ev lve %ey n$ the $ra!t speci!icati ns that have alrea$y %een put ! rwar$& What)s m re( these changes will pr %a%ly ccur rapi$ly %ecause there is such a push t st p e*ten$ing "TML an$ t start using a m re !le*i%le alternative& The ! ll wing list i$enti!ies s me nline res urces that y u can use t keep apprise$ ! all the $evel pments surr un$ing XML& 5e sure t check them !requently s that y u kn w the status ! the 1ne*t wave2 ! r We% $ cument markup& ' The W rl$ Wi$e We% 3 ns rtium is the ar%iter ! the XML speci!icati n& , u can !in$ the WF3 XML page at http7AAwww&wF& rgAXMLA& "ere y u will !in$ links t the m st recent XML( XLink( XE int( an$ XSL $ra!ts( an$ listings ! XML:relate$ s !tware( such as parsers an$ %r wsers& ' The XML +requently Aske$ @uesti ns /+A@0 list at http7AAwww&ucc&ieA*mlA is an e*cellent re!erence( with separate secti ns ! r general( user:( auth r:( an$ $evel per: relate$ questi ns& ' ; rman Walsh maintains a g $ set ! XML:relate$ % kmarks at http7AAnwalsh&c mAsgmlAin$e*&html& ' S n 5 sak ! Sun Micr systems auth re$ the highly regar$e$ article 1XML( Sava( an$ the +uture ! the We%(2 which l ks int the type ! aut mate$ pr cessing that will %e p ssi%le with XML:%ase$ $ cuments& , u can !in$ the article nline at http7AAsunsite&unc&e$uApu%Asun:in! Astan$ar$sA*mlAwhyA*mlapps&htm& ' , u can learn all a% ut 6SSSL( the %asis ! r the XML style speci!icati n( at http7AAwww&=clark&c mA$ssslA&

You might also like