X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Fpxp%2Fpxp%2Fdoc%2Fmanual%2Fps%2Fmarkup.ps;fp=helm%2FDEVEL%2Fpxp%2Fpxp%2Fdoc%2Fmanual%2Fps%2Fmarkup.ps;h=0000000000000000000000000000000000000000;hb=c7514aaa249a96c5fdd39b1123fbdb38d92f20b6;hp=3a98c796475942c6b757b71ae2141dd412aadc5e;hpb=1c7fb836e2af4f2f3d18afd0396701f2094265ff;p=helm.git diff --git a/helm/DEVEL/pxp/pxp/doc/manual/ps/markup.ps b/helm/DEVEL/pxp/pxp/doc/manual/ps/markup.ps deleted file mode 100644 index 3a98c7964..000000000 --- a/helm/DEVEL/pxp/pxp/doc/manual/ps/markup.ps +++ /dev/null @@ -1,8866 +0,0 @@ -%!PS-Adobe-2.0 -%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software -%%Pages: 96 -%%PageOrder: Ascend -%%BoundingBox: 0 0 596 842 -%%DocumentFonts: Helvetica-Bold Times-Roman Times-Bold Times-Italic -%%+ Courier Courier-Oblique Helvetica-BoldOblique Courier-Bold -%%DocumentPaperSizes: a4 -%%EndComments -%DVIPSWebPage: (www.radicaleye.com) -%DVIPSCommandLine: dvips -f -%DVIPSParameters: dpi=600, compressed -%DVIPSSource: TeX output 2000.08.30:1757 -%%BeginProcSet: texc.pro -%! -/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S -N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 -mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 -0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ -landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize -mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ -matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round -exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ -statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] -N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin -/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array -/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 -array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N -df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A -definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get -}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} -B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr -1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 -1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx -0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx -sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ -rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp -gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B -/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ -/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ -A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy -get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} -ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp -fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 -{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add -chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ -1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} -forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn -/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put -}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ -bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A -mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ -SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ -userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X -1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 -index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N -/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ -/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) -(LaserWriter 16/600)]{A length product length le{A length product exch 0 -exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse -end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask -grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} -imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round -exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto -fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p -delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} -B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ -p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S -rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end - -%%EndProcSet -%%BeginProcSet: 8r.enc -% @@psencodingfile@{ -% author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry", -% version = "0.6", -% date = "1 July 1998", -% filename = "8r.enc", -% email = "tex-fonts@@tug.org", -% docstring = "Encoding for TrueType or Type 1 fonts -% to be used with TeX." -% @} -% -% Idea is to have all the characters normally included in Type 1 fonts -% available for typesetting. This is effectively the characters in Adobe -% Standard Encoding + ISO Latin 1 + extra characters from Lucida. -% -% Character code assignments were made as follows: -% -% (1) the Windows ANSI characters are almost all in their Windows ANSI -% positions, because some Windows users cannot easily reencode the -% fonts, and it makes no difference on other systems. The only Windows -% ANSI characters not available are those that make no sense for -% typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen -% (173). quotesingle and grave are moved just because it's such an -% irritation not having them in TeX positions. -% -% (2) Remaining characters are assigned arbitrarily to the lower part -% of the range, avoiding 0, 10 and 13 in case we meet dumb software. -% -% (3) Y&Y Lucida Bright includes some extra text characters; in the -% hopes that other PostScript fonts, perhaps created for public -% consumption, will include them, they are included starting at 0x12. -% -% (4) Remaining positions left undefined are for use in (hopefully) -% upward-compatible revisions, if someday more characters are generally -% available. -% -% (5) hyphen appears twice for compatibility with both -% ASCII and Windows. -% -/TeXBase1Encoding [ -% 0x00 (encoded characters from Adobe Standard not in Windows 3.1) - /.notdef /dotaccent /fi /fl - /fraction /hungarumlaut /Lslash /lslash - /ogonek /ring /.notdef - /breve /minus /.notdef -% These are the only two remaining unencoded characters, so may as -% well include them. - /Zcaron /zcaron -% 0x10 - /caron /dotlessi -% (unusual TeX characters available in, e.g., Lucida Bright) - /dotlessj /ff /ffi /ffl - /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef - % very contentious; it's so painful not having quoteleft and quoteright - % at 96 and 145 that we move the things normally found there to here. - /grave /quotesingle -% 0x20 (ASCII begins) - /space /exclam /quotedbl /numbersign - /dollar /percent /ampersand /quoteright - /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash -% 0x30 - /zero /one /two /three /four /five /six /seven - /eight /nine /colon /semicolon /less /equal /greater /question -% 0x40 - /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O -% 0x50 - /P /Q /R /S /T /U /V /W - /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore -% 0x60 - /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o -% 0x70 - /p /q /r /s /t /u /v /w - /x /y /z /braceleft /bar /braceright /asciitilde - /.notdef % rubout; ASCII ends -% 0x80 - /.notdef /.notdef /quotesinglbase /florin - /quotedblbase /ellipsis /dagger /daggerdbl - /circumflex /perthousand /Scaron /guilsinglleft - /OE /.notdef /.notdef /.notdef -% 0x90 - /.notdef /.notdef /.notdef /quotedblleft - /quotedblright /bullet /endash /emdash - /tilde /trademark /scaron /guilsinglright - /oe /.notdef /.notdef /Ydieresis -% 0xA0 - /.notdef % nobreakspace - /exclamdown /cent /sterling - /currency /yen /brokenbar /section - /dieresis /copyright /ordfeminine /guillemotleft - /logicalnot - /hyphen % Y&Y (also at 45); Windows' softhyphen - /registered - /macron -% 0xD0 - /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered - /cedilla /onesuperior /ordmasculine /guillemotright - /onequarter /onehalf /threequarters /questiondown -% 0xC0 - /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla - /Egrave /Eacute /Ecircumflex /Edieresis - /Igrave /Iacute /Icircumflex /Idieresis -% 0xD0 - /Eth /Ntilde /Ograve /Oacute - /Ocircumflex /Otilde /Odieresis /multiply - /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls -% 0xE0 - /agrave /aacute /acircumflex /atilde - /adieresis /aring /ae /ccedilla - /egrave /eacute /ecircumflex /edieresis - /igrave /iacute /icircumflex /idieresis -% 0xF0 - /eth /ntilde /ograve /oacute - /ocircumflex /otilde /odieresis /divide - /oslash /ugrave /uacute /ucircumflex - /udieresis /yacute /thorn /ydieresis -] def - -%%EndProcSet -%%BeginProcSet: texps.pro -%! -TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 -index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll -exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics -exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub -dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def} -ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict -end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{ -dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 -roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def -dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def} -if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def} -def end - -%%EndProcSet -%%BeginProcSet: special.pro -%! -TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N -/vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N -/rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N -/@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{ -/hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho -X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B -/@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{ -/urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known -{userdict/md get type/dicttype eq{userdict begin md length 10 add md -maxlength ge{/md md dup length 20 add dict copy def}if end md begin -/letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S -atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{ -itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll -transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll -curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf -pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack} -if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 --1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 -get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip -yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub -neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{ -noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop -90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get -neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr -1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr -2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 --1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S -TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{ -Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale -}if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState -save N userdict maxlength dict begin/magscale true def normalscale -currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts -/psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x -psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx -psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub -TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{ -psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 -roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath -moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict -begin/SpecialSave save N gsave normalscale currentpoint TR -@SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{ -CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto -closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx -sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR -}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse -CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury -lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N -/@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end} -repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N -/@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX -currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY -moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X -/yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0 -1 startangle endangle arc savematrix setmatrix}N end - -%%EndProcSet -%%BeginProcSet: color.pro -%! -TeXDict begin/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop -setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll -}repeat setrgbcolor pop}ifelse}B}ifelse/TeXcolorcmyk{setcmykcolor}def -/TeXcolorrgb{setrgbcolor}def/TeXcolorgrey{setgray}def/TeXcolorgray{ -setgray}def/TeXcolorhsb{sethsbcolor}def/currentcmykcolor where{pop}{ -/currentcmykcolor{currentrgbcolor 10}B}ifelse/DC{exch dup userdict exch -known{pop pop}{X}ifelse}B/GreenYellow{0.15 0 0.69 0 setcmykcolor}DC -/Yellow{0 0 1 0 setcmykcolor}DC/Goldenrod{0 0.10 0.84 0 setcmykcolor}DC -/Dandelion{0 0.29 0.84 0 setcmykcolor}DC/Apricot{0 0.32 0.52 0 -setcmykcolor}DC/Peach{0 0.50 0.70 0 setcmykcolor}DC/Melon{0 0.46 0.50 0 -setcmykcolor}DC/YellowOrange{0 0.42 1 0 setcmykcolor}DC/Orange{0 0.61 -0.87 0 setcmykcolor}DC/BurntOrange{0 0.51 1 0 setcmykcolor}DC -/Bittersweet{0 0.75 1 0.24 setcmykcolor}DC/RedOrange{0 0.77 0.87 0 -setcmykcolor}DC/Mahogany{0 0.85 0.87 0.35 setcmykcolor}DC/Maroon{0 0.87 -0.68 0.32 setcmykcolor}DC/BrickRed{0 0.89 0.94 0.28 setcmykcolor}DC/Red{ -0 1 1 0 setcmykcolor}DC/OrangeRed{0 1 0.50 0 setcmykcolor}DC/RubineRed{ -0 1 0.13 0 setcmykcolor}DC/WildStrawberry{0 0.96 0.39 0 setcmykcolor}DC -/Salmon{0 0.53 0.38 0 setcmykcolor}DC/CarnationPink{0 0.63 0 0 -setcmykcolor}DC/Magenta{0 1 0 0 setcmykcolor}DC/VioletRed{0 0.81 0 0 -setcmykcolor}DC/Rhodamine{0 0.82 0 0 setcmykcolor}DC/Mulberry{0.34 0.90 -0 0.02 setcmykcolor}DC/RedViolet{0.07 0.90 0 0.34 setcmykcolor}DC -/Fuchsia{0.47 0.91 0 0.08 setcmykcolor}DC/Lavender{0 0.48 0 0 -setcmykcolor}DC/Thistle{0.12 0.59 0 0 setcmykcolor}DC/Orchid{0.32 0.64 0 -0 setcmykcolor}DC/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}DC/Purple{ -0.45 0.86 0 0 setcmykcolor}DC/Plum{0.50 1 0 0 setcmykcolor}DC/Violet{ -0.79 0.88 0 0 setcmykcolor}DC/RoyalPurple{0.75 0.90 0 0 setcmykcolor}DC -/BlueViolet{0.86 0.91 0 0.04 setcmykcolor}DC/Periwinkle{0.57 0.55 0 0 -setcmykcolor}DC/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}DC -/CornflowerBlue{0.65 0.13 0 0 setcmykcolor}DC/MidnightBlue{0.98 0.13 0 -0.43 setcmykcolor}DC/NavyBlue{0.94 0.54 0 0 setcmykcolor}DC/RoyalBlue{1 -0.50 0 0 setcmykcolor}DC/Blue{1 1 0 0 setcmykcolor}DC/Cerulean{0.94 0.11 -0 0 setcmykcolor}DC/Cyan{1 0 0 0 setcmykcolor}DC/ProcessBlue{0.96 0 0 0 -setcmykcolor}DC/SkyBlue{0.62 0 0.12 0 setcmykcolor}DC/Turquoise{0.85 0 -0.20 0 setcmykcolor}DC/TealBlue{0.86 0 0.34 0.02 setcmykcolor}DC -/Aquamarine{0.82 0 0.30 0 setcmykcolor}DC/BlueGreen{0.85 0 0.33 0 -setcmykcolor}DC/Emerald{1 0 0.50 0 setcmykcolor}DC/JungleGreen{0.99 0 -0.52 0 setcmykcolor}DC/SeaGreen{0.69 0 0.50 0 setcmykcolor}DC/Green{1 0 -1 0 setcmykcolor}DC/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}DC -/PineGreen{0.92 0 0.59 0.25 setcmykcolor}DC/LimeGreen{0.50 0 1 0 -setcmykcolor}DC/YellowGreen{0.44 0 0.74 0 setcmykcolor}DC/SpringGreen{ -0.26 0 0.76 0 setcmykcolor}DC/OliveGreen{0.64 0 0.95 0.40 setcmykcolor} -DC/RawSienna{0 0.72 1 0.45 setcmykcolor}DC/Sepia{0 0.83 1 0.70 -setcmykcolor}DC/Brown{0 0.81 1 0.60 setcmykcolor}DC/Tan{0.14 0.42 0.56 0 -setcmykcolor}DC/Gray{0 0 0 0.50 setcmykcolor}DC/Black{0 0 0 1 -setcmykcolor}DC/White{0 0 0 0 setcmykcolor}DC end - -%%EndProcSet -TeXDict begin 39158280 55380996 1000 600 600 () @start -/Fa 106[21 149[{TeXBase1Encoding ReEncodeFont}1 59.7758 -/Times-Roman rf /Fb 135[77 2[77 77 77 3[77 77 77 3[77 -3[77 77 77 99[{TeXBase1Encoding ReEncodeFont}11 129.116 -/Courier-Bold rf /Fc 134[65 65 2[65 65 65 65 1[65 65 -65 65 65 2[65 65 65 65 65 65 65 65 65 1[65 36[65 6[65 -65 65 49[{TeXBase1Encoding ReEncodeFont}25 107.597 /Courier-Bold -rf /Fd 141[56 4[128 7[80 88 2[80 97[{TeXBase1Encoding ReEncodeFont}5 -143.462 /Helvetica-BoldOblique rf /Fe 147[21 4[37 1[33 -3[37 23[25 14[25 58[{TeXBase1Encoding ReEncodeFont}6 -74.7198 /Times-Italic rf /Ff 204[25 25 25 49[{ -TeXBase1Encoding ReEncodeFont}3 49.8132 /Times-Roman -rf -%DVIPSBitmapFont: Fg cmmi8 8 2 -/Fg 2 63 df60 -D<12E012F812FEEA3F80EA0FE0EA03F8EA00FEEB3F80EB0FE0EB03F8EB00FC143FEC0FC0 -EC07F0EC01FCEC007FED1FC0ED07F0ED01FCED007FEE1FC01607161FEE7F00ED01FCED07 -F0ED1FC0037FC7FCEC01FCEC07F0EC0FC0023FC8FC14FCEB03F8EB0FE0EB3F8001FEC9FC -EA03F8EA0FE0EA3F8000FECAFC12F812E02A2B7AA537>62 D E -%EndDVIPSBitmapFont -/Fh 131[40 1[40 40 40 40 40 40 40 40 40 40 40 40 40 40 -40 40 1[40 40 40 1[40 40 40 40 40 1[40 5[40 3[40 40 40 -40 40 40 40 40 40 40 40 1[40 40 40 1[40 40 40 40 40 1[40 -40 40 40 40 40 1[40 4[40 1[40 1[40 40 40 40 40 40 40 -40 40 40 40 1[40 40 40 33[{TeXBase1Encoding ReEncodeFont}69 -67.2479 /Courier rf /Fi 105[37 28[37 37 54 37 37 21 29 -25 37 37 37 37 58 21 37 1[21 37 37 25 33 37 33 37 33 -7[54 54 3[46 5[54 66 46 2[25 2[42 2[50 50 54 5[21 21 -11[19 1[19 2[25 25 25 4[30 31[42 2[{TeXBase1Encoding ReEncodeFont}45 -74.7198 /Times-Roman rf /Fj 135[55 7[61 2[89 28 6[55 -3[55 27[66 69[{TeXBase1Encoding ReEncodeFont}7 99.6264 -/Helvetica-Bold rf /Fk 145[27 2[27 57[27 49[{ -TeXBase1Encoding ReEncodeFont}3 44.8318 /Courier-Oblique -rf /Fl 135[50 3[50 50 3[50 50 3[50 50 3[50 1[50 50 2[50 -95[{TeXBase1Encoding ReEncodeFont}11 83.022 /Courier-Oblique -rf -%DVIPSBitmapFont: Fm cmmi10 10 2 -/Fm 2 63 df60 -D<126012FCB4FCEA7FC0EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FCEB01FF9038007F -C0EC1FF0EC07FCEC01FF9138007FC0ED1FF0ED07FCED01FF9238007FC0EE1FF0EE07FCEE -01FF9338007F80EF1FC0A2EF7F80933801FF00EE07FCEE1FF0EE7FC04B48C7FCED07FCED -1FF0ED7FC04A48C8FCEC07FCEC1FF0EC7FC04948C9FCEB07FCEB1FF0EB7FC04848CAFCEA -07FCEA3FF0EA7FC048CBFC12FC1270323279AD41>62 D E -%EndDVIPSBitmapFont -/Fn 134[45 45 1[45 45 45 45 45 1[45 45 45 45 45 1[45 -45 45 45 45 45 45 45 45 45 1[45 5[45 2[45 8[45 5[45 2[45 -45 1[45 19[45 45 44[{TeXBase1Encoding ReEncodeFont}32 -74.7198 /Courier-Oblique rf -%DVIPSBitmapFont: Fo cmmi9 9 2 -/Fo 2 63 df<171C177EEE01FEEE07FCEE1FF0EE7FC0923801FF00ED07FCED1FF0ED7FC0 -4A48C7FCEC07FCEC1FF0EC7FC04948C8FCEB07FCEB1FF0EB7FC04848C9FCEA07FCEA1FF0 -EA7FC048CAFCA2EA7FC0EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FCEB01FF9038007F -C0EC1FF0EC07FCEC01FF9138007FC0ED1FF0ED07FCED01FF9238007FC0EE1FF0EE07FCEE -01FEEE007E171C2F2E7AA93C>60 D<127012FCB4FCEA7FC0EA1FF0EA07FCEA01FF38007F -C0EB1FF0EB07FCEB01FF9038007FC0EC1FF0EC07FCEC01FF9138007FC0ED1FF0ED07FCED -01FF9238007FC0EE1FF0EE07FCEE01FEA2EE07FCEE1FF0EE7FC0923801FF00ED07FCED1F -F0ED7FC04A48C7FCEC07FCEC1FF0EC7FC04948C8FCEB07FCEB1FF0EB7FC04848C9FCEA07 -FCEA1FF0EA7FC048CAFC12FC12702F2E7AA93C>62 D E -%EndDVIPSBitmapFont -/Fp 134[66 66 93 66 73 40 66 47 1[73 73 73 106 33 2[33 -73 73 40 66 73 66 73 66 8[80 113 80 86 73 80 86 1[80 -1[86 100 73 2[33 86 1[73 80 86 86 1[86 1[73 5[66 66 66 -66 66 66 66 66 66 66 1[33 40 33 2[40 40 5[57 31[73 2[{ -TeXBase1Encoding ReEncodeFont}58 119.552 /Helvetica-Bold -rf /Fq 129[45 45 45 45 45 45 45 45 45 45 45 45 45 45 -45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 -45 45 45 45 1[45 45 45 45 45 45 45 45 45 45 45 45 45 -45 45 1[45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 -45 45 45 45 1[45 45 45 45 45 45 45 45 45 45 45 45 45 -45 45 45 45 1[45 45 45 33[{TeXBase1Encoding ReEncodeFont}90 -74.7198 /Courier rf /Fr 134[37 37 55 37 42 23 32 32 1[42 -42 42 60 23 37 23 23 42 42 23 37 42 37 42 42 1[42 6[51 -69 1[60 46 42 2[51 1[55 69 46 2[28 3[51 60 55 1[51 1[42 -4[28 42 42 42 42 42 42 42 42 42 42 1[21 28 21 2[28 28 -6[28 30[42 2[{TeXBase1Encoding ReEncodeFont}58 83.022 -/Times-Italic rf /Fs 138[105 57 96 67 1[105 105 105 153 -48 1[48 48 105 105 57 96 105 96 105 96 8[115 163 1[124 -105 3[115 2[143 105 5[105 2[124 3[105 10[96 96 96 96 -2[48 43[105 2[{TeXBase1Encoding ReEncodeFont}35 172.154 -/Helvetica-Bold rf /Ft 106[23 29 29 25[33 33 48 33 33 -18 26 22 1[33 33 33 52 18 33 18 18 33 33 22 29 33 29 -33 29 8[48 3[41 37 2[37 6[22 1[48 12[18 10[18 17 1[17 -2[22 22 5[27 31[37 2[{TeXBase1Encoding ReEncodeFont}41 -66.4176 /Times-Roman rf /Fu 134[42 42 60 42 46 28 32 -37 1[46 42 46 69 23 46 1[23 46 42 28 37 46 37 46 42 9[83 -60 60 55 46 60 3[60 78 55 2[32 65 65 51 55 60 60 55 60 -1[42 6[42 1[42 42 42 42 42 42 2[21 28 21 4[28 39[{ -TeXBase1Encoding ReEncodeFont}53 83.022 /Times-Bold rf -/Fv 27[37 58[63 42[45 40 1[40 37 42 42 60 42 42 23 32 -28 42 42 42 42 65 23 42 23 23 42 42 28 37 42 37 42 37 -28 42 1[28 23 28 1[60 60 78 60 60 51 46 55 60 46 60 60 -74 51 60 1[28 60 60 46 51 60 55 55 60 1[37 47 47 47 23 -23 42 42 42 42 42 42 42 42 42 42 23 21 28 21 2[28 28 -28 65 69 1[42 34 28 29[46 46 2[{TeXBase1Encoding ReEncodeFont}90 -83.022 /Times-Roman rf /Fw 136[65 1[51 1[46 32 2[51 51 -1[23 2[23 51 51 1[46 51 2[46 8[55 3[51 3[55 11[60 9[28 -18[23 39[{TeXBase1Encoding ReEncodeFont}19 83.022 /Helvetica-Bold -rf /Fx 134[80 80 112 80 88 48 80 56 1[88 88 88 128 40 -80 1[40 88 88 48 80 88 80 88 80 8[96 1[96 104 88 96 104 -2[112 104 120 88 2[40 104 112 1[96 104 104 1[104 6[48 -4[80 80 80 80 80 2[40 48 45[{TeXBase1Encoding ReEncodeFont}48 -143.462 /Helvetica-Bold rf /Fy 138[126 1[115 80 8[57 -126 126 1[115 126 11[138 2[149 126 3[138 6[57 26[57 6[57 -39[{TeXBase1Encoding ReEncodeFont}15 206.584 /Helvetica-Bold -rf end -%%EndProlog -%%BeginSetup -%%Feature: *Resolution 600dpi -TeXDict begin -%%BeginPaperSize: a4 -a4 -%%EndPaperSize - -%%EndSetup -%%Page: 1 1 -1 0 bop Black Black 890 647 a Fy(The)58 b(PXP)f(user')-12 -b(s)58 b(guide)1384 2594 y Fx(Ger)m(d)39 b(Stolpmann)p -Black Black eop -%%Page: 2 2 -2 1 bop Black Black -2 579 a Fw(The)22 b(PXP)j(user')-5 -b(s)23 b(guide)-2 687 y Fv(by)d(Gerd)f(Stolpmann)-2 903 -y(Cop)o(yright)f(\251)j(1999,)e(2000)g(by)g(Gerd)h(Stolpmann)-2 -1135 y(PXP)h(is)g(a)g(v)n(alidating)d(parser)i(for)f(XML-1.0)g(which)h -(has)g(been)g(written)g(entirely)f(in)h(Objecti)n(v)o(e)g(Caml.)-2 -1285 y Fw(Do)o(wnload)h(PXP:)j Fv(The)c(free)g(PXP)h(library)e(can)h -(be)g(do)n(wnloaded)d(at)k(http://www)-5 b(.ocaml-programming)o(.de)o -(/pack)o(age)o(s/.)15 b(This)-2 1393 y(user')-5 b(s)20 -b(guide)f(is)j(included.)c(Ne)n(west)j(releases)f(of)g(PXP)h(will)g(be) -f(announced)e(in)i(The)g(OCaml)g(Link)g(Database)-2 1500 -y(\(http://www)-5 b(.npc.de/ocaml/linkdb)o(/\).)-2 1899 -y Fu(License)-2 2090 y Ft(This)16 b(document,)j(and)e(the)h(described)h -(softw)o(are,)f("PXP",)e(are)i(cop)o(yright)i(by)d(Gerd)g(Stolpmann.)-2 -2198 y(Permission)h(is)e(hereby)j(granted,)f(free)g(of)f(char)o(ge,)h -(to)f(an)o(y)h(person)f(obtaining)j(a)d(cop)o(y)h(of)f(this)h(document) -g(and)g(the)f("PXP")g(softw)o(are)i(\(the)f("Softw)o(are"\),)g(to)f -(deal)i(in)-2 2306 y(the)f(Softw)o(are)g(without)h(restriction,)g -(including)h(without)e(limitation)i(the)e(rights)g(to)f(use,)g(cop)o(y) -l(,)g(modify)l(,)g(mer)o(ge,)g(publish,)h(distrib)o(ute,)h(sublicense,) -g(and/or)f(sell)-2 2414 y(copies)g(of)f(the)h(Softw)o(are,)g(and)g(to)f -(permit)h(persons)f(to)h(whom)e(the)i(Softw)o(are)h(is)e(furnished)h -(to)f(do)g(so,)g(subject)h(to)g(the)f(follo)n(wing)j(conditions:)-2 -2522 y(The)d(abo)o(v)o(e)h(cop)o(yright)h(notice)g(and)f(this)f -(permission)h(notice)h(shall)f(be)g(included)h(in)e(all)h(copies)h(or)e -(substantial)i(portions)g(of)e(the)g(Softw)o(are.)-2 -2630 y(The)g(Softw)o(are)h(is)f(pro)o(vided)i(\223as)e(is\224,)g -(without)i(w)o(arranty)g(of)e(an)o(y)g(kind,)h(e)o(xpress)f(or)g -(implied,)i(including)g(b)o(ut)e(not)h(limited)h(to)e(the)h(w)o -(arranties)h(of)e(merchantability)l(,)-2 2737 y(\002tness)g(for)g(a)g -(particular)j(purpose)e(and)g(noninfringement.)i(In)d(no)g(e)n(v)o(ent) -h(shall)h(Gerd)e(Stolpmann)h(be)g(liable)h(for)e(an)o(y)g(claim,)h -(damages)g(or)f(other)h(liability)l(,)i(whether)-2 2845 -y(in)d(an)g(action)i(of)e(contract,)i(tort)f(or)f(otherwise,)i(arising) -f(from,)e(out)i(of)f(or)g(in)g(connection)j(with)e(the)f(Softw)o(are)i -(or)e(the)h(use)f(or)g(other)h(dealings)h(in)e(the)h(softw)o(are.)p -Black Black eop -%%Page: 3 3 -3 2 bop Black Black -2 621 a Fs(T)-14 b(ab)n(le)48 b(of)g(Contents)396 -815 y Fu(I.)21 b(User')m(s)g(guide)p Black 4 w(.)p Black -Black -1 w(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black 4 w(6)596 -943 y Fv(1.)f(What)g(is)h(XML?)p Black 4 w(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black 4 w(7)795 1051 -y(1.1.)e(Introduction)p Black 14 w(.)p Black Black -1 -w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black 4 w(7)994 1159 -y(1.1.1.)g(The)g("hello)h(w)o(orld")g(e)o(xample)p Black -13 w(.)p Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black 4 w(7)994 1267 y(1.1.2.)f(XML)h(parsers)g(and)f -(processors)p Black 3 w(.)p Black Black -2 w(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black 4 w(9)994 1375 y(1.1.3.)g(Discussion)p -Black 9 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -4 w(9)795 1483 y(1.2.)g(Highlights)g(of)h(XML)p Black -10 w(.)p Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(11)994 -1591 y(1.2.1.)f(The)g(DTD)i(and)e(the)i(instance)p Black -15 w(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(11)994 1699 y(1.2.2.)e(Reserv)o(ed)g(characters)p -Black 19 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(12)994 1807 y(1.2.3.)g(Elements)g(and)h -(ELEMENT)f(declarations)p Black 7 w(.)p Black Black -2 -w(.)p Black Black(.)p Black Black(.)p Black Black -1 -w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(13)994 -1915 y(1.2.4.)g(Attrib)n(ute)g(lists)j(and)e(A)-9 b(TTLIST)19 -b(declarations)p Black 6 w(.)p Black Black -2 w(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(15)994 2023 y(1.2.5.)g(P)o(arsed)g(entities)p -Black 18 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(16)994 2131 y(1.2.6.)g(Notations)g(and)h -(unparsed)e(entities)p Black 14 w(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(19)795 2238 y(1.3.)h(A)i(complete)e(e)o(xample:)g -(The)h Fr(r)m(eadme)f Fv(DTD)p Black 3 w(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(20)596 2346 y(2.)h(Using)g(PXP)p Black -6 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(24)795 2454 y(2.1.)f(V)-9 b(alidation)p -Black 3 w(.)p Black Black -2 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(24)795 -2562 y(2.2.)19 b(Ho)n(w)h(to)g(parse)g(a)h(document)d(from)h(an)h -(application)p Black 10 w(.)p Black Black -2 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(24)795 -2670 y(2.3.)f(Class-based)h(processing)f(of)h(the)g(node)g(tree)p -Black 8 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(29)795 -2778 y(2.4.)f(Example:)g(An)h(HTML)g(back)o(end)f(for)g(the)i -Fr(r)m(eadme)e Fv(DTD)p Black 3 w(.)p Black Black -1 -w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(33)994 2886 y(2.4.1.)g(Header)p -Black 9 w(.)p Black Black -2 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(33)994 2994 y(2.4.2.)g(T)-7 b(ype)19 -b(declarations)p Black 14 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(33)994 3102 y(2.4.3.)g(Class)i Fq(store)p Black -11 w Fv(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(34)994 3210 y(2.4.4.)e(Function)g -Fq(escape_html)p Black Fv(.)p Black Black -2 w(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(35)994 3318 y(2.4.5.)g(V)-5 b(irtual)20 b(class)h -Fq(shared)p Black 4 w Fv(.)p Black Black -2 w(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(35)994 3426 y(2.4.6.)e(Class)i -Fq(only_data)p Black 17 w Fv(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(36)994 -3534 y(2.4.7.)e(Class)i Fq(readme)p Black 8 w Fv(.)p -Black Black -1 w(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(36)994 3642 y(2.4.8.)e(Classes)i -Fq(section)p Fv(,)f Fq(sect1)p Fv(,)f Fq(sect2)p Fv(,)h(and)g -Fq(sect3)p Black 13 w Fv(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(39)994 3749 y(2.4.9.)f(Classes)i -Fq(map_tag)p Fv(,)f Fq(p)p Fv(,)g Fq(em)p Fv(,)g Fq(ul)p -Fv(,)g Fq(li)p Black 16 w Fv(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(39)994 -3857 y(2.4.10.)e(Class)k Fq(br)p Black Fv(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(40)994 3965 y(2.4.11.)c(Class)k -Fq(code)p Black 13 w Fv(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(40)994 4073 y(2.4.12.)c(Class)k -Fq(a)p Black 4 w Fv(.)p Black Black -1 w(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(41)994 -4181 y(2.4.13.)c(Class)k Fq(footnote)p Black 1 w Fv(.)p -Black Black -2 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(42)994 4289 -y(2.4.14.)c(The)i(speci\002cation)f(of)h(the)g(document)f(model)p -Black 12 w(.)p Black Black -2 w(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(43)596 4397 y(3.)h(The)f(objects)h -(representing)e(the)j(document)p Black 4 w(.)p Black -Black -3 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(46)795 4505 y(3.1.)e(The)h Fq(document)f Fv(class)p -Black 7 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(46)795 4613 y(3.2.)g(The)h(class)h(type)f -Fq(node)p Black 2 w Fv(.)p Black Black -2 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(47)994 4721 y(3.2.1.)f(The)g(structure)h(of)g(document)e(trees)p -Black 3 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(49)994 -4829 y(3.2.2.)h(The)g(methods)h(of)f(the)i(class)g(type)f -Fq(node)p Black 13 w Fv(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(52)p Black 3842 -5278 a Fr(3)p Black eop -%%Page: 4 4 -4 3 bop Black Black 994 579 a Fv(3.2.3.)19 b(The)g(class)j -Fq(element_impl)p Black 2 w Fv(.)p Black Black -3 w(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(56)994 687 y(3.2.4.)d(The)g(class)j Fq(data_impl)p -Black 12 w Fv(.)p Black Black -2 w(.)p Black Black -1 -w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(57)994 -795 y(3.2.5.)d(The)g(type)h Fq(spec)p Black 5 w Fv(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(58)994 903 y(3.2.6.)f(Examples)p Black -5 w(.)p Black Black -3 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(60)994 -1011 y(3.2.7.)g(Iterators)p Black 12 w(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(64)795 1119 y(3.3.)g(The)h(class)h(type)f Fq(extension)p -Black 6 w Fv(.)p Black Black -2 w(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(65)994 1226 y(3.3.1.)f(Ho)n(w)h(to)g(de\002ne) -g(an)g(e)o(xtension)f(class)p Black 13 w(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(66)994 1334 -y(3.3.2.)g(Ho)n(w)h(to)g(bind)f(e)o(xtension)g(classes)i(to)g(element)e -(types)p Black 10 w(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(68)795 1442 y(3.4.)g(Details)i(of)f(the)g(mapping)e(from)i(XML)g -(te)o(xt)g(to)g(the)g(tree)h(representation)p Black 13 -w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(69)994 -1550 y(3.4.1.)e(The)g(representation)g(of)g(character)n(-free)f -(elements)p Black 9 w(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(69)994 1658 y(3.4.2.)h(The)g(representation)g(of)g(character)g -(data)p Black 10 w(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(70)994 1766 -y(3.4.3.)g(The)g(representation)g(of)g(entities)i(within)f(documents)p -Black 12 w(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(70)994 1874 y(3.4.4.)f(The)g(representation)g -(of)g(attrib)n(utes)p Black 20 w(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(71)994 1982 y(3.4.5.)g(The)g(representation)g(of)g -(processing)g(instructions)p Black(.)p Black Black -1 -w(.)p Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(71)994 2090 y(3.4.6.)g(The)g -(representation)g(of)g(comments)p Black 7 w(.)p Black -Black -1 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(71)994 2198 y(3.4.7.)g(The)g(attrib)n(utes)i -Fq(xml:lang)e Fv(and)h Fq(xml:space)p Black 10 w Fv(.)p -Black Black -2 w(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(72)994 2306 y(3.4.8.)f(And)g(what)h(about)g(namespaces?)p -Black 12 w(.)p Black Black -2 w(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(72)596 -2414 y(4.)g(Con\002guring)e(and)h(calling)h(the)g(parser)p -Black 11 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(73)795 2522 y(4.1.)f(Ov)o(ervie)n(w)p -Black 19 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(73)795 -2630 y(4.2.)g(Resolv)o(ers)h(and)g(sources)p Black 2 -w(.)p Black Black -1 w(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(75)994 2737 -y(4.2.1.)f(Using)h(the)g(b)n(uilt-in)f(resolv)o(ers)h(\(called)f -(sources\))p Black 5 w(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(75)994 2845 y(4.2.2.)g(The)g(resolv)o(er)g(API)p -Black 11 w(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(76)994 2953 y(4.2.3.)g(Prede\002ned)f(resolv)o(er)h -(components)p Black 13 w(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black 4 w(78)795 3061 -y(4.3.)g(The)h(DTD)g(classes)p Black 1 w(.)p Black Black -1 w(.)p Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(81)795 -3169 y(4.4.)f(In)m(v)n(oking)f(the)i(parser)p Black 14 -w(.)p Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(89)994 -3277 y(4.4.1.)f(Def)o(aults)p Black 10 w(.)p Black Black --1 w(.)p Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(89)994 3385 y(4.4.2.)g(P)o(arsing)g(functions)p -Black 4 w(.)p Black Black -3 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(90)994 3493 y(4.4.3.)g(Con\002guration)f(options)p -Black 19 w(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(91)994 3601 y(4.4.4.)h(Which)h -(con\002guration)d(should)i(I)i(use?)p Black 18 w(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(93)795 3709 y(4.5.)e(Updates)p Black 10 w(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(95)p Black 3842 5278 a -Fr(4)p Black eop -%%Page: 5 5 -5 4 bop Black Black -2 621 a Fs(List)48 b(of)g(Figures)396 -815 y Fv(3-1.)19 b(A)i(tree)f(with)h(element)e(nodes,)h(data)g(nodes,)f -(and)g(attrib)n(utes)p Black 18 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black 4 w(49)396 923 y(3-2.)g(Nodes)h(are)g(doubly)f(link)o -(ed)g(trees)p Black 15 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black 4 w(50)396 -1031 y(3-3.)g(A)i(node)e(can)h(only)g(be)g(added)f(if)h(it)h(is)g(a)g -(root)p Black 5 w(.)p Black Black -1 w(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black 4 w(51)396 1139 y(3-4.)e(A)i(deleted)f(node)f -(becomes)g(the)h(root)g(of)g(the)g(subtree)p Black 3 -w(.)p Black Black -1 w(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -4 w(51)396 1247 y(3-5.)f(The)h(clone)g(of)g(a)g(subtree)p -Black 18 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black 4 w(52)396 1355 y(3-6.)f(The)h(structure)g -(of)f(nodes)h(and)g(e)o(xtensions)p Black 18 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black -1 w(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black Black(.)p Black Black(.)p Black Black(.)p Black -Black -1 w(.)p Black Black(.)p Black Black(.)p Black -Black(.)p Black Black -1 w(.)p Black Black(.)p Black -Black(.)p Black Black(.)p Black Black -1 w(.)p Black -Black(.)p Black Black(.)p Black Black(.)p Black Black --1 w(.)p Black Black(.)p Black Black(.)p Black Black(.)p -Black Black -1 w(.)p Black Black(.)p Black Black(.)p -Black Black(.)p Black Black(.)p Black Black -1 w(.)p -Black 4 w(65)p Black 3842 5278 a Fr(5)p Black eop -%%Page: 6 6 -6 5 bop Black Black 1241 647 a Fy(I.)58 b(User')-12 b(s)57 -b(guide)p Black Black eop -%%Page: 7 7 -7 6 bop Black Black -2 621 a Fs(Chapter)48 b(1.)f(What)h(is)f(XML?)-2 -1055 y Fx(1.1.)39 b(Intr)m(oduction)396 1235 y Fv(XML)20 -b(\(short)g(for)f Fr(Extensible)h(Markup)g(Langua)o(g)o(e)p -Fv(\))e(generalizes)h(the)h(idea)g(that)g(te)o(xt)g(documents)f(are)h -(typically)396 1343 y(structured)f(in)h(sections,)g(sub-sections,)f -(paragraphs,)f(and)i(so)g(on.)g(The)g(format)f(of)h(the)g(document)e -(is)j(not)f(\002x)o(ed)g(\(as,)396 1451 y(for)g(e)o(xample,)e(in)j -(HTML\),)e(b)n(ut)h(can)g(be)g(declared)f(by)h(a)h(so-called)e(DTD)i -(\(document)c(type)j(de\002nition\).)f(The)g(DTD)396 -1559 y(describes)h(only)f(the)i(rules)f(ho)n(w)f(the)i(document)d(can)i -(be)g(structured,)e(b)n(ut)j(not)e(ho)n(w)h(the)g(document)e(can)i(be) -396 1667 y(processed.)f(F)o(or)h(e)o(xample,)e(if)j(you)e(w)o(ant)i(to) -f(publish)f(a)i(book)e(that)h(uses)h(XML)f(markup,)e(you)h(will)i(need) -f(a)g(processor)396 1775 y(that)h(con)m(v)o(erts)d(the)i(XML)g(\002le)h -(into)f(a)h(printable)e(format)g(such)h(as)h(Postscript.)f(On)g(the)g -(one)g(hand,)f(the)h(structure)f(of)396 1883 y(XML)h(documents)f(is)i -(con\002gurable;)d(on)i(the)g(other)f(hand,)g(there)h(is)h(no)f(longer) -f(a)h(canonical)f(interpretation)f(of)i(the)396 1991 -y(elements)g(of)g(the)g(document;)f(for)g(e)o(xample)g(one)h(XML)g(DTD) -g(might)g(w)o(ant)g(that)g(paragraphes)e(are)i(delimited)g(by)396 -2099 y Fq(para)g Fv(tags,)h(and)e(another)g(DTD)h(e)o(xpects)g -Fq(p)g Fv(tags)h(for)e(the)i(same)f(purpose.)e(As)j(a)g(result,)f(for)g -(e)n(v)o(ery)e(DTD)j(a)f(ne)n(w)396 2206 y(processor)f(is)i(required.) -396 2356 y(Although)e(XML)h(can)g(be)g(used)g(to)g(e)o(xpress)g -(structured)f(te)o(xt)h(documents)e(it)j(is)g(not)f(limited)g(to)g -(this)h(kind)e(of)396 2464 y(application.)g(F)o(or)h(e)o(xample,)e(XML) -i(can)g(also)h(be)f(used)g(to)g(e)o(xchange)e(structured)h(data)h(o)o -(v)o(er)f(a)h(netw)o(ork,)f(or)h(to)396 2572 y(simply)g(store)g -(structured)f(data)h(in)g(\002les.)h(Note)f(that)h(XML)f(documents)e -(cannot)i(contain)f(arbitrary)f(binary)h(data)396 2680 -y(because)g(some)g(characters)g(are)g(forbidden;)e(for)i(some)g -(applications)g(you)f(need)h(to)h(encode)e(binary)g(data)h(as)h(te)o -(xt)g(\(e.g.)396 2788 y(the)g(base)h(64)f(encoding\).)-2 -3116 y Fp(1.1.1.)35 b(The)f("hello)g(w)n(orld")e(e)n(xample)396 -3283 y Fv(The)20 b(follo)n(wing)f(e)o(xample)f(sho)n(ws)j(a)f(v)o(ery)f -(simple)i(DTD,)f(and)f(a)i(corresponding)c(document)h(instance.)h(The) -396 3391 y(document)f(is)k(structured)c(such)i(that)h(it)f(consists)h -(of)f(sections,)g(and)g(that)g(sections)g(consist)h(of)f(paragraphs,)d -(and)j(that)396 3499 y(paragraphs)e(contain)h(plain)h(te)o(xt:)396 -3679 y Fq()396 -3777 y()396 3874 -y()396 4065 y Fv(The)20 -b(follo)n(wing)f(document)f(is)j(an)f(instance)g(of)g(this)h(DTD:)396 -4245 y Fq()396 -4342 y()396 -4439 y()486 4536 y(
)576 4633 y(This)e(is) -i(a)h(paragraph)e(of)i(the)f(first)g(section.)576 -4731 y(This)e(is)i(another)g(paragraph)f(of)i(the)f(first)g -(section.)486 4828 y(
)p Black 3839 -5278 a Fr(7)p Black eop -%%Page: 8 8 -8 7 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 486 579 a Fq(
)576 676 y(This)42 -b(is)i(the)h(only)f(paragraph)f(of)i(the)f(second)g -(section.)486 773 y(
)396 870 y(
)396 -1061 y Fv(As)21 b(in)g(HTML)f(\(and,)f(of)h(course,)f(in)h(grand-f)o -(ather)d(SGML\),)j(the)g("pieces")g(of)g(the)g(document)f(are)h -(delimited)f(by)396 1169 y(element)h(braces,)f(i.e.)i(such)f(a)g(piece) -g(be)o(gins)f(with)i Fo(<)p Fq(name-of-the-type-of-the-piece)p -Fo(>)15 b Fv(and)20 b(ends)g(with)396 1277 y Fo(<)p Fq -(/name-of-the-type-of-the-piece)p Fo(>)p Fv(,)15 b(and)20 -b(the)g(pieces)g(are)g(called)g Fr(elements)p Fv(.)g(Unlik)o(e)g(HTML)g -(and)396 1385 y(SGML,)g(both)g(start)g(tags)h(and)f(end)f(tags)i -(\(i.e.)f(the)g(delimiters)g(written)g(in)g(angle)g(brack)o(ets\))f -(can)h(ne)n(v)o(er)f(be)h(left)g(out.)396 1493 y(F)o(or)g(e)o(xample,)f -(HTML)h(calls)h(the)f(paragraphs)e(simply)i Fq(p)p Fv(,)g(and)f -(because)h(paragraphs)e(ne)n(v)o(er)h(contain)g(paragraphs,)f(a)396 -1601 y(sequence)h(of)h(se)n(v)o(eral)g(paragraphs)e(can)i(be)g(written) -g(as:)396 1781 y Fq(

First)44 b(paragraph)396 1878 -y(

Second)g(paragraph)396 2069 y Fv(This)21 b(is)g(not)f(possible)g -(in)g(XML;)g(continuing)e(our)i(e)o(xample)e(abo)o(v)o(e)h(we)h(must)h -(al)o(w)o(ays)f(write)396 2249 y Fq(First)42 -b(paragraph)396 2346 y(Second)g -(paragraph)396 2537 y Fv(The)20 b(rationale)f(behind)g -(that)h(is)i(to)e(\(1\))f(simplify)h(the)g(de)n(v)o(elopment)d(of)j -(XML)h(parsers)f(\(you)e(need)i(not)g(con)m(v)o(ert)e(the)396 -2645 y(DTD)j(into)f(a)g(deterministic)f(\002nite)i(automaton)d(which)i -(is)h(required)d(to)j(detect)f(omitted)f(tags\),)h(and)g(to)g(\(2\))g -(mak)o(e)f(it)396 2753 y(possible)h(to)h(parse)e(the)i(document)d -(independent)f(of)j(whether)f(the)i(DTD)f(is)h(kno)n(wn)e(or)h(not.)396 -2903 y(The)g(\002rst)h(line)f(of)g(our)g(sample)g(document,)396 -3083 y Fq()396 -3274 y Fv(is)21 b(the)e(so-called)g Fr(XML)h(declar)o(ation)p -Fv(.)d(It)j(e)o(xpresses)e(that)i(the)f(document)f(follo)n(ws)h(the)g -(con)m(v)o(entions)e(of)i(XML)g(v)o(ersion)396 3382 y(1.0,)h(and)f -(that)h(the)h(document)d(is)j(encoded)d(using)i(characters)f(from)g -(the)i(ISO-8859-1)c(character)i(set)i(\(often)e(kno)n(wn)396 -3490 y(as)i("Latin)e(1",)g(mostly)h(used)f(in)h(W)-7 -b(estern)20 b(Europe\).)d(Although)h(the)i(XML)g(declaration)e(is)i -(not)g(mandatory)-5 b(,)16 b(it)21 b(is)f(good)396 3598 -y(style)h(to)f(include)f(it;)i(e)n(v)o(erybody)c(sees)k(at)g(the)f -(\002rst)h(glance)f(that)g(the)g(document)e(uses)j(XML)f(markup)f(and)g -(not)h(the)396 3706 y(similar)n(-looking)e(HTML)i(and)g(SGML)g(markup)f -(languages.)f(If)i(you)g(omit)g(the)g(XML)g(declaration,)e(the)j -(parser)e(will)396 3813 y(assume)h(that)h(the)f(document)e(is)j -(encoded)e(as)i(UTF-8)e(or)h(UTF-16)f(\(there)h(is)h(a)g(rule)e(that)i -(mak)o(es)f(it)h(possible)f(to)396 3921 y(distinguish)f(between)h -(UTF-8)g(and)f(UTF-16)g(automatically\);)g(these)h(are)g(encodings)f -(of)h(Unicode')-5 b(s)19 b(uni)n(v)o(ersal)396 4029 y(character)g(set.) -i(\(Note)f(that)g(PXP,)h(unlik)o(e)e(its)i(predecessor)e("Markup",)f -(fully)i(supports)f(Unicode.\))396 4179 y(The)h(second)f(line,)396 -4359 y Fq()396 -4550 y Fv(names)20 b(the)g(DTD)h(that)f(is)h(going)e(to)h(be)g(used)g -(for)g(the)g(rest)h(of)f(the)g(document.)e(In)i(general,)f(it)i(is)g -(possible)f(that)g(the)396 4658 y(DTD)h(consists)f(of)g(tw)o(o)h -(parts,)f(the)g(so-called)f(e)o(xternal)g(and)h(the)g(internal)f -(subset.)h("External")f(means)h(that)g(the)h(DTD)396 -4766 y(e)o(xists)g(as)g(a)f(second)g(\002le;)h("internal")e(means)h -(that)g(the)g(DTD)h(is)g(included)d(in)j(the)f(same)g(\002le.)h(In)f -(this)g(e)o(xample,)f(there)p Black 3842 5278 a Fr(8)p -Black eop -%%Page: 9 9 -9 8 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fv(is)g(only)f(an)g(e)o(xternal)f(subset,)h(and)g(the)g -(system)g(identi\002er)g("simple.dtd")e(speci\002es)j(where)f(the)g -(DTD)g(\002le)h(can)f(be)396 687 y(found.)e(System)j(identi\002ers)f -(are)g(interpreted)e(as)j(URLs;)g(for)f(instance)g(this)g(w)o(ould)g -(be)g(le)o(gal:)396 867 y Fq()396 1058 y Fv(Please)21 -b(note)f(that)g(PXP)h(cannot)e(interpret)g(HTTP)i(identi\002ers)e(by)h -(def)o(ault,)f(b)n(ut)i(it)g(is)g(possible)f(to)g(change)f(the)396 -1166 y(interpretation)f(of)i(system)h(identi\002ers.)396 -1315 y(The)f(w)o(ord)g(immediately)f(follo)n(wing)f Fq(DOCTYPE)i -Fv(determines)f(which)g(of)h(the)g(declared)f(element)h(types)g(\(here) -396 1423 y("document",)e("section",)h(and)h("paragraph"\))d(is)k(used)f -(for)g(the)g(outermost)f(element,)g(the)h Fr(r)l(oot)h(element)q -Fv(.)f(In)g(this)396 1531 y(e)o(xample)f(it)i(is)g Fq(document)f -Fv(because)f(the)h(outermost)f(element)h(is)h(delimited)e(by)h -Fo(<)p Fq(document)p Fo(>)f Fv(and)396 1639 y Fo(<)p -Fq(/document)p Fo(>)p Fv(.)396 1789 y(The)h(DTD)g(consists)h(of)f -(three)g(declarations)f(for)g(element)h(types:)g Fq(document)p -Fv(,)f Fq(section)p Fv(,)g(and)h Fq(paragraph)p Fv(.)f(Such)396 -1896 y(a)i(declaration)d(has)j(tw)o(o)f(parts:)396 2077 -y Fo(<)p Fq(!ELEMENT)43 b Fn(name)i(content-model)p Fo(>)396 -2268 y Fv(The)20 b(content)f(model)h(is)h(a)f(re)o(gular)f(e)o -(xpression)g(which)g(describes)h(the)g(possible)g(inner)f(structure)h -(of)g(the)g(element.)396 2376 y(Here,)g Fq(document)f -Fv(contains)h(one)g(or)g(more)f(sections,)h(and)g(a)g -Fq(section)g Fv(contains)f(one)h(or)g(more)f(paragraphs.)f(Note)396 -2483 y(that)j(these)f(tw)o(o)g(element)g(types)g(are)g(not)g(allo)n -(wed)f(to)i(contain)e(arbitrary)g(te)o(xt.)g(Only)h(the)g -Fq(paragraph)g Fv(element)f(type)396 2591 y(is)i(declared)e(such)h -(that)h(parsed)e(character)g(data)h(\(indicated)f(by)h(the)g(symbol)f -Fq(#PCDATA)p Fv(\))g(is)i(permitted.)396 2741 y(See)g(belo)n(w)e(for)h -(a)h(detailed)e(discussion)h(of)g(content)f(models.)-2 -3110 y Fp(1.1.2.)35 b(XML)e(par)n(ser)n(s)h(and)g(pr)n(ocessor)n(s)396 -3278 y Fv(XML)20 b(documents)f(are)h(human-readable,)c(b)n(ut)21 -b(this)f(is)h(not)f(the)h(main)e(purpose)g(of)h(this)h(language.)d(XML) -i(has)g(been)396 3386 y(designed)f(such)h(that)g(documents)f(can)h(be)g -(read)g(by)f(a)i(program)d(called)i(an)g Fr(XML)h(par)o(ser)r -Fv(.)f(The)g(parser)g(checks)f(that)396 3494 y(the)h(document)f(is)i -(well-formatted,)d(and)h(it)i(represents)f(the)g(document)e(as)j -(objects)f(of)g(the)g(programming)d(language.)396 3602 -y(There)j(are)g(tw)o(o)g(aspects)h(when)e(checking)g(the)h(document:)e -(First,)j(the)f(document)e(must)j(follo)n(w)e(some)h(basic)396 -3710 y(syntactic)g(rules,)g(such)g(as)h(that)f(tags)h(are)f(written)g -(in)g(angle)g(brack)o(ets,)f(that)h(for)g(e)n(v)o(ery)f(start)h(tag)h -(there)e(must)i(be)f(a)396 3818 y(corresponding)d(end)j(tag)g(and)f(so) -i(on.)f(A)g(document)e(respecting)h(these)i(rules)f(is)h -Fr(well-formed)r Fv(.)f(Second,)f(the)396 3926 y(document)f(must)j -(match)e(the)i(DTD)f(in)g(which)g(case)h(the)f(document)e(is)j -Fr(valid)r Fv(.)f(Man)o(y)f(parsers)h(check)f(only)h(on)396 -4034 y(well-formedness)e(and)i(ignore)f(the)h(DTD;)h(PXP)g(is)g -(designed)e(such)g(that)i(it)g(can)f(e)n(v)o(en)f(v)n(alidate)g(the)i -(document.)396 4183 y(A)g(parser)f(does)f(not)h(mak)o(e)g(a)h(sensible) -f(application,)e(it)j(only)f(reads)g(XML)g(documents.)e(The)i(whole)g -(application)396 4291 y(w)o(orking)f(with)h(XML-formatted)e(data)i(is)h -(called)f(an)g Fr(XML)h(pr)l(ocessor)r Fv(.)f(Often)g(XML)g(processors) -f(con)m(v)o(ert)396 4399 y(documents)g(into)h(another)e(format,)h(such) -h(as)h(HTML)f(or)g(Postscript.)g(Sometimes)g(processors)f(e)o(xtract)g -(data)h(of)g(the)396 4507 y(documents)f(and)g(output)g(the)i(processed) -e(data)h(again)f(XML-formatted.)e(The)j(parser)g(can)g(help)f(the)i -(application)396 4615 y(processing)e(the)h(document;)f(for)g(e)o -(xample)g(it)i(can)f(pro)o(vide)e(means)i(to)g(access)h(the)f(document) -e(in)j(a)f(speci\002c)h(manner)-5 b(.)396 4723 y(PXP)21 -b(supports)e(an)i(object-oriented)c(access)k(layer)e(specially)-5 -b(.)p Black 3842 5278 a Fr(9)p Black eop -%%Page: 10 10 -10 9 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black -2 583 a Fp(1.1.3.)35 b(Discussion)396 751 y Fv(As)21 -b(we)g(ha)n(v)o(e)e(seen,)h(there)g(are)g(tw)o(o)h(le)n(v)o(els)f(of)g -(description:)f(On)h(the)g(one)g(hand,)f(XML)h(can)g(de\002ne)f(rules)i -(about)e(the)396 859 y(format)g(of)h(a)h(document)d(\(the)i(DTD\),)g -(on)f(the)i(other)e(hand,)g(XML)h(e)o(xpresses)g(structured)f -(documents.)f(There)h(are)h(a)396 967 y(number)f(of)h(possible)f -(applications:)p Black 396 1199 a Ft(\225)p Black 60 -w Fv(XML)i(can)f(be)g(used)g(to)g(e)o(xpress)f(structured)g(te)o(xts.)h -(Unlik)o(e)g(HTML,)g(there)g(is)h(no)e(canonical)g(interpretation;)g -(one)479 1307 y(w)o(ould)h(ha)n(v)o(e)f(to)i(write)f(a)h(back)o(end)d -(for)i(the)g(DTD)g(that)h(translates)f(the)g(structured)f(te)o(xts)h -(into)g(a)h(format)e(that)479 1415 y(e)o(xisting)h(bro)n(wsers,)f -(printers)g(etc.)i(understand.)c(The)j(adv)n(antage)e(of)i(a)h -(self-de\002ned)e(document)f(format)h(is)i(that)f(it)479 -1523 y(is)h(possible)f(to)h(design)e(the)h(format)f(in)i(a)f(more)g -(problem-oriented)c(w)o(ay)-5 b(.)20 b(F)o(or)f(e)o(xample,)g(if)h(the) -h(task)f(is)h(to)g(e)o(xtract)479 1631 y(reports)f(from)f(a)h -(database,)g(one)f(can)h(use)h(a)f(DTD)h(that)f(re\003ects)h(the)f -(structure)f(of)h(the)g(report)f(or)h(the)g(database.)g(A)479 -1739 y(possible)g(approach)e(w)o(ould)i(be)g(to)g(ha)n(v)o(e)g(an)g -(element)f(type)h(for)g(e)n(v)o(ery)f(database)g(table)h(and)g(for)g(e) -n(v)o(ery)e(column.)479 1847 y(Once)i(the)g(DTD)h(has)f(been)g -(designed,)e(the)j(report)e(procedure)e(can)j(be)g(splitted)h(up)e(in)i -(a)f(part)g(that)h(selects)g(the)479 1955 y(database)f(ro)n(ws)g(and)g -(outputs)f(them)h(as)h(an)f(XML)g(document)e(according)g(to)j(the)f -(DTD,)g(and)g(in)g(a)g(part)g(that)479 2063 y(translates)h(the)f -(document)e(into)i(other)f(formats.)g(Of)i(course,)e(the)h(latter)h -(part)e(can)h(be)h(solv)o(ed)e(in)h(a)h(generic)e(w)o(ay)-5 -b(,)479 2170 y(e.g.)20 b(there)g(may)f(be)h(con\002gurable)e(back)o -(ends)h(for)h(all)g(DTDs)h(that)f(follo)n(w)g(the)g(approach)e(and)i -(ha)n(v)o(e)f(element)h(types)479 2278 y(for)g(tables)g(and)g(columns.) -479 2428 y(XML)h(plays)f(the)g(role)g(of)g(a)g(con\002gurable)e -(intermediate)h(format.)g(The)g(database)h(e)o(xtraction)e(function)h -(can)h(be)479 2536 y(written)g(without)g(ha)n(ving)f(to)h(kno)n(w)f -(the)h(details)h(of)f(typesetting;)f(the)h(back)o(ends)f(can)h(be)g -(written)g(without)g(ha)n(ving)479 2644 y(to)h(kno)n(w)e(the)h(details) -h(of)e(the)i(database.)479 2793 y(Of)g(course,)e(there)h(are)g -(traditional)f(solutions.)g(One)h(can)g(de\002ne)g(an)g(ad)g(hoc)g -(intermediate)e(te)o(xt)j(\002le)f(format.)f(This)479 -2901 y(disadv)n(antage)f(is)k(that)e(there)g(are)g(no)f(names)h(for)g -(the)g(pieces)g(of)g(the)g(format,)f(and)h(that)g(such)g(formats)g -(usually)f(lack)479 3009 y(of)h(documentation)d(because)j(of)g(this.)g -(Another)f(solution)g(w)o(ould)h(be)g(to)g(ha)n(v)o(e)g(a)h(binary)e -(representation,)e(either)j(as)479 3117 y(language-dependent)c(or)k -(language-independent)14 b(structure)20 b(\(e)o(xample)e(of)i(the)g -(latter)h(can)f(be)g(found)e(in)j(RPC)479 3225 y(implementations\).)d -(The)i(disadv)n(antage)e(is)j(that)f(it)h(is)g(harder)e(to)i(vie)n(w)f -(such)g(representations,)e(one)h(has)i(to)f(write)479 -3333 y(pretty)g(printers)f(for)h(this)g(purpose.)f(It)h(is)h(also)g -(more)e(dif)n(\002cult)h(to)g(enter)g(test)h(data;)f(XML)g(is)h(plain)f -(te)o(xt)g(that)h(can)f(be)479 3441 y(written)g(using)g(an)g(arbitrary) -f(editor)g(\(Emacs)h(has)g(e)n(v)o(en)f(a)i(good)e(XML)h(mode,)f -(PSGML\).)h(All)h(these)f(alternati)n(v)o(es)479 3549 -y(suf)n(fer)g(from)f(a)h(missing)g(structure)g(check)o(er)m(,)e(i.e.)i -(the)h(programs)d(processing)h(these)h(formats)f(usually)h(do)g(not)479 -3657 y(check)g(the)g(input)f(\002le)i(or)f(input)g(object)f(in)i -(detail;)f(XML)g(parsers)g(check)f(the)h(syntax)g(of)g(the)g(input)g -(\(the)f(so-called)479 3765 y(well-formedness)f(check\),)h(and)h(the)g -(adv)n(anced)e(parsers)i(lik)o(e)g(PXP)h(e)n(v)o(en)f(v)o(erify)e(that) -j(the)f(structure)f(matches)h(the)479 3872 y(DTD)h(\(the)f(so-called)f -(v)n(alidation\).)p Black 396 4022 a Ft(\225)p Black -60 w Fv(XML)i(can)f(be)g(used)g(as)g(con\002gurable)e(communication)g -(language.)g(A)i(fundamental)e(problem)h(of)h(e)n(v)o(ery)479 -4130 y(communication)e(is)j(that)f(sender)f(and)h(recei)n(v)o(er)f -(must)h(follo)n(w)g(the)g(same)g(con)m(v)o(entions)e(about)h(the)h -(language.)e(F)o(or)479 4238 y(data)i(e)o(xchange,)e(the)i(question)f -(is)j(usually)d(which)h(data)g(records)f(and)h(\002elds)g(are)g(a)n(v)n -(ailable,)g(ho)n(w)g(the)o(y)f(are)479 4346 y(syntactically)h -(composed,)e(and)i(which)f(v)n(alues)h(are)g(possible)g(for)g(the)g(v)n -(arious)f(\002elds.)h(Similar)h(questions)e(arise)479 -4454 y(for)h(te)o(xt)g(document)e(e)o(xchange.)g(XML)i(does)g(not)g -(answer)g(these)g(problems)f(completely)-5 b(,)18 b(b)n(ut)i(it)h -(reduces)e(the)479 4562 y(number)g(of)h(ambiguities)f(for)g(such)h(con) -m(v)o(entions:)e(The)i(outlines)f(of)h(the)g(syntax)g(are)g -(speci\002ed)g(by)g(the)g(DTD)g(\(b)n(ut)479 4669 y(not)g(necessarily)g -(the)g(details\),)g(and)g(XML)g(introduces)e(canonical)h(names)h(for)g -(the)g(components)e(of)i(documents)479 4777 y(such)g(that)h(it)f(is)i -(simpler)d(to)i(describe)e(the)h(rest)h(of)f(the)g(syntax)g(and)f(the)h -(semantics)h(informally)-5 b(.)p Black 3800 5278 a Fr(10)p -Black eop -%%Page: 11 11 -11 10 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black Black 396 579 a Ft(\225)p Black 60 w Fv(XML)f(is)g(a)g(data)f -(storage)g(format.)f(Currently)-5 b(,)17 b(e)n(v)o(ery)h(softw)o(are)h -(product)f(tends)h(to)h(use)f(its)i(o)n(wn)d(w)o(ay)i(to)f(store)h -(data;)479 687 y(commercial)f(softw)o(are)h(often)f(does)h(not)g -(describe)f(such)h(formats,)f(and)h(it)h(is)g(a)g(pain)e(to)i(inte)o -(grate)e(such)h(softw)o(are)479 795 y(into)g(a)g(bigger)f(project.)f -(XML)i(can)g(help)f(to)h(impro)o(v)o(e)e(this)j(situation)e(when)g(se)n -(v)o(eral)g(applications)g(share)h(the)g(same)479 903 -y(syntax)g(of)g(data)g(\002les.)h(DTDs)f(are)g(then)g(neutral)g -(instances)g(that)g(check)f(the)h(format)g(of)f(data)i(\002les)g -(independent)c(of)479 1011 y(applications.)-2 1512 y -Fx(1.2.)39 b(Highlights)e(of)i(XML)396 1692 y Fv(This)21 -b(section)f(e)o(xplains)f(man)o(y)g(of)h(the)g(features)f(of)h(XML,)g -(b)n(ut)h(not)e(all,)i(and)f(some)g(features)f(not)h(in)g(detail.)g(F)o -(or)g(a)396 1800 y(complete)f(description,)g(see)i(the)f(XML)g -(speci\002cation)396 1908 y(\(http://www)-5 b(.w3.or)o -(g/TR/1998/REC-xml-)o(19)o(98)o(02)o(10)o(.htm)o(l\).)-2 -2236 y Fp(1.2.1.)35 b(The)f(DTD)g(and)g(the)f(instance)396 -2404 y Fv(The)20 b(DTD)g(contains)g(v)n(arious)f(declarations;)g(in)h -(general)f(you)h(can)g(only)f(use)i(a)f(feature)f(if)i(you)e(ha)n(v)o -(e)h(pre)n(viously)396 2512 y(declared)f(it.)i(The)f(document)e -(instance)i(\002le)h(may)e(contain)g(the)i(full)f(DTD,)g(b)n(ut)g(it)h -(is)g(also)g(possible)f(to)g(split)h(the)f(DTD)396 2619 -y(into)g(an)g(internal)g(and)f(an)h(e)o(xternal)f(subset.)h(A)h -(document)d(must)j(be)o(gin)e(as)h(follo)n(ws)g(if)h(the)f(full)g(DTD)g -(is)h(included:)396 2800 y Fo(<)p Fq(?xml)44 b(version="1.0")f -(encoding=")p Fn(Your)f(encoding)t Fq("?)p Fo(>)396 2897 -y(<)p Fq(!DOCTYPE)h Fn(root)i Fq([)486 2994 y Fn(Declarations)396 -3091 y Fq(])p Fo(>)396 3282 y Fv(These)20 b(declarations)f(are)h -(called)g(the)h Fr(internal)e(subset)q Fv(.)i(Note)f(that)g(the)g -(usage)g(of)g(entities)h(and)e(conditional)g(sections)396 -3390 y(is)i(restricted)f(within)g(the)g(internal)g(subset.)396 -3539 y(If)g(the)h(declarations)d(are)j(located)e(in)h(a)h(dif)n(ferent) -e(\002le,)h(you)f(can)h(refer)g(to)g(this)h(\002le)g(as)g(follo)n(ws:) -396 3720 y Fo(<)p Fq(?xml)44 b(version="1.0")f(encoding=")p -Fn(Your)f(encoding)t Fq("?)p Fo(>)396 3817 y(<)p Fq(!DOCTYPE)h -Fn(root)i Fq(SYSTEM)e(")p Fn(file)h(name)p Fq(")p Fo(>)396 -4008 y Fv(The)20 b(declarations)f(in)h(the)h(\002le)f(are)h(called)f -(the)g Fr(e)n(xternal)g(subset)q Fv(.)g(The)g(\002le)h(name)f(is)h -(called)f(the)g Fr(system)h(identi\002er)r Fv(.)e(It)396 -4116 y(is)i(also)g(possible)f(to)g(refer)g(to)g(the)g(\002le)h(by)f(a)g -(so-called)g Fr(public)f(identi\002er)r Fv(,)g(b)n(ut)i(most)f(XML)g -(applications)f(w)o(on')o(t)g(use)396 4223 y(this)i(feature.)396 -4373 y(Y)-9 b(ou)20 b(can)g(also)g(specify)g(both)f(internal)h(and)f(e) -o(xternal)g(subsets.)i(In)e(this)i(case,)g(the)f(declarations)f(of)h -(both)f(subsets)i(are)396 4481 y(mix)o(ed,)e(and)h(if)g(there)g(are)g -(con\003icts,)g(the)g(declaration)f(of)h(the)g(internal)f(subset)i(o)o -(v)o(errides)d(those)i(of)g(the)g(e)o(xternal)396 4589 -y(subset)h(with)f(the)g(same)h(name.)e(This)h(looks)g(as)h(follo)n(ws:) -396 4769 y Fo(<)p Fq(?xml)44 b(version="1.0")f(encoding=")p -Fn(Your)f(encoding)t Fq("?)p Fo(>)396 4866 y(<)p Fq(!DOCTYPE)h -Fn(root)89 b Fq(SYSTEM)44 b(")p Fn(file)g(name)p Fq(")g([)p -Black 3800 5278 a Fr(11)p Black eop -%%Page: 12 12 -12 11 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 486 579 a Fn(Declarations)396 676 y Fq(])p Fo(>)396 -909 y Fv(The)f(XML)g(declaration)f(\(the)h(string)g(be)o(ginning)d -(with)k Fo(<)p Fq(?xml)e Fv(and)h(ending)f(at)i Fq(?)p -Fo(>)p Fv(\))f(should)f(specify)g(the)h(encoding)396 -1016 y(of)g(the)g(\002le.)h(Common)e(v)n(alues)h(are)g(UTF-8,)f(and)h -(the)g(ISO-8859)e(series)j(of)f(character)f(sets.)i(Note)f(that)g(e)n -(v)o(ery)f(\002le)396 1124 y(parsed)h(by)f(the)i(XML)f(processor)f(can) -h(be)o(gin)f(with)h(an)g(XML)h(declaration)d(and)i(that)g(e)n(v)o(ery)f -(\002le)i(may)e(ha)n(v)o(e)h(its)h(o)n(wn)396 1232 y(encoding.)396 -1382 y(The)f(name)g(of)g(the)g(root)f(element)h(must)g(be)g(mentioned)f -(directly)g(after)h(the)g Fq(DOCTYPE)g Fv(string.)f(This)i(means)e -(that)i(a)396 1490 y(full)f(document)f(instance)g(looks)h(lik)o(e)396 -1670 y Fo(<)p Fq(?xml)44 b(version="1.0")f(encoding=")p -Fn(Your)f(encoding)t Fq("?)p Fo(>)396 1767 y(<)p Fq(!DOCTYPE)h -Fn(root)89 b Fq(SYSTEM)44 b(")p Fn(file)g(name)p Fq(")g([)486 -1864 y Fn(Declarations)396 1961 y Fq(])p Fo(>)396 2156 -y(<)p Fn(root)p Fo(>)486 2253 y Fn(inner)g(contents)396 -2350 y Fo(<)p Fq(/)p Fn(root)p Fo(>)-2 2802 y Fp(1.2.2.)35 -b(Reser)q(ved)h(c)o(haracter)n(s)396 2970 y Fv(Some)20 -b(characters)f(are)i(generally)d(reserv)o(ed)h(to)h(indicate)g(markup)e -(such)i(that)g(the)o(y)g(cannot)f(be)h(used)g(for)g(character)396 -3078 y(data.)g(These)g(characters)f(are)h Fm(<)p Fv(,)h -Fm(>)p Fv(,)f(and)f(&.)h(Furthermore,)e(single)i(and)g(double)e(quotes) -i(are)g(sometimes)g(reserv)o(ed.)396 3186 y(If)g(you)g(w)o(ant)g(to)g -(include)f(such)h(a)h(character)e(as)i(character)m(,)d(write)j(it)f(as) -h(follo)n(ws:)p Black 396 3473 a Ft(\225)p Black 60 w -Fq(<)f Fv(instead)g(of)g Fm(<)p Black 396 3581 a Ft(\225)p -Black 60 w Fq(>)g Fv(instead)g(of)g Fm(>)p Black 396 -3689 a Ft(\225)p Black 60 w Fq(&)g Fv(instead)g(of)g(&)p -Black 396 3797 a Ft(\225)p Black 60 w Fq(')g Fv(instead)g(of)g(')p -Black 396 3905 a Ft(\225)p Black 60 w Fq(")g Fv(instead)g(of)g(") -396 4054 y(All)h(other)e(characters)h(are)g(free)g(in)g(the)g(document) -e(instance.)i(It)g(is)i(possible)d(to)i(include)e(a)i(character)e(by)g -(its)j(position)396 4162 y(in)f(the)f(Unicode)f(alphabet:)396 -4342 y Fq(&#)p Fn(n)p Fq(;)396 4533 y Fv(where)h Fl(n)g -Fv(is)i(the)e(decimal)f(number)g(of)h(the)g(character)-5 -b(.)19 b(Alternati)n(v)o(ely)-5 b(,)18 b(you)h(can)h(specify)g(the)g -(character)f(by)h(its)396 4641 y(he)o(xadecimal)e(number:)396 -4822 y Fq(&#x)p Fn(n)p Fq(;)p Black 3800 5278 a Fr(12)p -Black eop -%%Page: 13 13 -13 12 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fv(In)f(the)g(scope)g(of)g(declarations,)f(the)h -(character)f(\045)i(is)g(no)f(longer)f(free.)g(T)-7 b(o)20 -b(include)g(it)h(as)f(character)m(,)f(you)g(must)h(use)396 -687 y(the)g(notations)g Fq(%)g Fv(or)f Fq(%)p -Fv(.)396 836 y(Note)h(that)h(besides)f(<,)g(>,)g(&,)f -(',)g(and)h(")f(there)h(are)g(no)g(prede\002nes)f(character)g -(entities.)h(This)396 944 y(is)h(dif)n(ferent)e(from)g(HTML)h(which)g -(de\002nes)g(a)g(list)i(of)d(characters)h(that)g(can)g(be)g(referenced) -e(by)i(name)f(\(e.g.)h(ä)396 1052 y(for)g(\344\);)g(ho)n(we)n(v)o -(er)m(,)e(if)i(you)g(prefer)e(named)i(characters,)f(you)g(can)h -(declare)f(such)h(entities)h(yourself)e(\(see)h(belo)n(w\).)-2 -1422 y Fp(1.2.3.)35 b(Elements)g(and)f(ELEMENT)e(dec)n(larations)396 -1589 y Fv(Elements)20 b(structure)f(the)h(document)f(instance)g(in)i(a) -f(hierarchical)f(w)o(ay)-5 b(.)20 b(There)f(is)i(a)g(top-le)n(v)o(el)d -(element,)i(the)g Fr(r)l(oot)396 1697 y(element)q Fv(,)g(which)g -(contains)g(a)g(sequence)f(of)h(inner)g(elements)f(and)h(character)f -(sections.)h(The)g(inner)f(elements)h(are)396 1805 y(structured)f(in)h -(the)f(same)h(w)o(ay)-5 b(.)20 b(Ev)o(ery)e(element)h(has)h(an)g -Fr(element)f(type)p Fv(.)h(The)f(be)o(ginning)f(of)h(the)h(element)f -(is)i(indicated)396 1913 y(by)f(a)h Fr(start)g(ta)o(g)p -Fv(,)e(written)396 2093 y Fo(<)p Fn(element-type)p Fo(>)396 -2284 y Fv(and)h(the)g(element)g(continues)f(until)h(the)g -(corresponding)d Fr(end)i(ta)o(g)h Fv(is)h(reached:)396 -2465 y Fo(<)p Fq(/)p Fn(element-type)p Fo(>)396 2655 -y Fv(In)f(XML,)f(it)i(is)f(not)g(allo)n(wed)f(to)h(omit)f(start)i(or)e -(end)g(tags,)h(e)n(v)o(en)f(if)h(the)g(DTD)g(w)o(ould)f(permit)g(this.) -h(Note)g(that)g(there)f(are)396 2763 y(no)h(special)g(rules)g(ho)n(w)g -(to)g(interpret)g(spaces)g(or)g(ne)n(wlines)g(near)f(start)i(or)f(end)g -(tags;)g(all)h(spaces)f(and)g(ne)n(wlines)g(count.)396 -2913 y(Ev)o(ery)f(element)h(type)f(must)i(be)f(declared)f(before)f(it)j -(can)f(be)g(used.)g(The)g(declaration)f(consists)h(of)g(tw)o(o)h -(parts:)f(the)396 3021 y(ELEMENT)f(declaration)f(describes)h(the)h -(content)f(model,)f(i.e.)i(which)f(inner)g(elements)g(are)h(allo)n -(wed;)f(the)h(A)-9 b(TTLIST)396 3129 y(declaration)19 -b(describes)h(the)g(attrib)n(utes)g(of)g(the)g(element.)396 -3278 y(An)g(element)g(can)g(simply)g(allo)n(w)g(e)n(v)o(erything)e(as)i -(content.)f(This)i(is)g(written:)396 3458 y Fo(<)p Fq(!ELEMENT)43 -b Fn(name)i Fq(ANY)p Fo(>)396 3649 y Fv(On)20 b(the)h(opposite,)e(an)h -(element)f(can)h(be)g(forced)f(to)i(be)f(empty;)f(declared)g(by:)396 -3829 y Fo(<)p Fq(!ELEMENT)43 b Fn(name)i Fq(EMPTY)p Fo(>)396 -4020 y Fv(Note)20 b(that)h(there)e(is)j(an)e(abbre)n(viated)e(notation) -h(for)g(empty)g(element)h(instances:)g Fo(<)p Fn(name)p -Fq(/)p Fo(>)p Fv(.)396 4170 y(There)g(are)g(tw)o(o)g(more)g -(sophisticated)f(forms)g(of)h(declarations:)f(so-called)h -Fr(mixed)g(declar)o(ations)p Fv(,)e(and)i Fr(r)m(e)m(gular)396 -4278 y(e)n(xpr)m(essions)p Fv(.)g(An)h(element)e(with)i(mix)o(ed)e -(content)g(contains)g(character)g(data)h(interspersed)f(with)i(inner)e -(elements,)396 4386 y(and)h(the)g(set)h(of)f(allo)n(wed)g(inner)f -(elements)h(can)g(be)g(speci\002ed.)g(In)f(contrast)h(to)g(this,)h(a)g -(re)o(gular)d(e)o(xpression)396 4494 y(declaration)h(does)h(not)g(allo) -n(w)g(character)f(data,)h(b)n(ut)g(the)g(inner)f(elements)h(can)g(be)g -(described)f(by)h(the)g(more)g(po)n(werful)396 4601 y(means)g(of)g(re)o -(gular)f(e)o(xpressions.)396 4751 y(A)i(declaration)e(for)g(mix)o(ed)g -(content)g(looks)h(as)h(follo)n(ws:)p Black 3800 5278 -a Fr(13)p Black eop -%%Page: 14 14 -14 13 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fo(<)p Fq(!ELEMENT)43 b Fn(name)i Fq(\(#PCDATA)e(|)i -Fn(element)1892 609 y Fk(1)1962 579 y Fq(|)g(...)f(|)h -Fn(element)2636 609 y Fk(n)2707 579 y Fq(\)*)p Fo(>)396 -770 y Fv(or)20 b(if)h(you)e(do)h(not)g(w)o(ant)g(to)g(allo)n(w)g(an)o -(y)g(inner)f(element,)h(simply)396 950 y Fo(<)p Fq(!ELEMENT)43 -b Fn(name)i Fq(\(#PCDATA\))p Fo(>)396 1279 y Fj(Example)479 -1426 y Fi(If)19 b(element)g(type)g Fh(q)g Fi(is)g(declared)h(as)479 -1596 y Fh()479 -1776 y Fi(this)19 b(is)f(a)h(le)o(gal)g(instance:)479 -1947 y Fh(This)43 b(is)e(character)j(datawith)h(inner) -g(elements)479 2127 y Fi(But)19 b(this)g(is)f(ille)o(gal)g(because) -i Fh(t)f Fi(has)h(not)f(been)g(enumerated)i(in)e(the)g(declaration:)479 -2297 y Fh(This)43 b(is)e(character)j(datawith)h(inner) -g(elements)396 2571 y Fv(The)20 b(other)f(form)h(uses)g(a)h(re)o -(gular)e(e)o(xpression)f(to)j(describe)e(the)h(possible)g(contents:)396 -2752 y Fo(<)p Fq(!ELEMENT)43 b Fn(name)i(regexp)p Fo(>)396 -2942 y Fv(The)20 b(follo)n(wing)f(well-kno)n(wn)f(re)o(ge)o(xp)g -(operators)h(are)h(allo)n(wed:)p Black 396 3299 a Ft(\225)p -Black 60 w Fn(element-name)p Black 396 3407 a Ft(\225)p -Black 60 w Fq(\()p Fn(subexpr)839 3437 y Fk(1)910 3407 -y Fq(,)g Fv(...)g Fq(,)45 b Fn(subexpr)1463 3437 y Fk(n)1533 -3407 y Fq(\))p Black 396 3515 a Ft(\225)p Black 60 w -Fq(\()p Fn(subexpr)839 3545 y Fk(1)910 3515 y Fq(|)20 -b Fv(...)g Fq(|)45 b Fn(subexpr)1463 3545 y Fk(n)1533 -3515 y Fq(\))p Black 396 3623 a Ft(\225)p Black 60 w -Fn(subexpr)s Fq(*)p Black 396 3731 a Ft(\225)p Black -60 w Fn(subexpr)s Fq(+)p Black 396 3839 a Ft(\225)p Black -60 w Fn(subexpr)s Fq(?)396 3989 y Fv(The)20 b Fq(,)h -Fv(operator)d(indicates)i(a)h(sequence)e(of)h(sub-models,)e(the)i -Fq(|)h Fv(operator)d(describes)i(alternati)n(v)o(e)f(sub-models.)f(The) -396 4096 y Fq(*)j Fv(indicates)f(zero)f(or)h(more)g(repetitions,)f(and) -g Fq(+)i Fv(one)f(or)f(more)h(repetitions.)f(Finally)-5 -b(,)19 b Fq(?)i Fv(can)f(be)g(used)g(for)f(optional)396 -4204 y(sub-models.)g(As)i(atoms)f(the)g(re)o(ge)o(xp)e(can)i(contain)f -(names)h(of)g(elements;)g(note)g(that)g(it)h(is)g(not)f(allo)n(wed)f -(to)i(include)396 4312 y Fq(#PCDATA)p Fv(.)396 4462 y(The)f(e)o(xact)g -(syntax)f(of)h(the)g(re)o(gular)f(e)o(xpressions)g(is)i(rather)e -(strange.)h(This)g(can)g(be)g(e)o(xplained)f(best)h(by)g(a)g(list)i(of) -396 4570 y(constraints:)p Black 396 4802 a Ft(\225)p -Black 60 w Fv(The)e(outermost)f(e)o(xpression)g(must)h(not)g(be)g -Fn(element-name)p Fv(.)p Black 3800 5278 a Fr(14)p Black -eop -%%Page: 15 15 -15 14 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 479 579 a(Ille)m(gal:)e Fq()p -Fv(;)21 b(this)f(must)h(be)f(written)g(as)h Fq()p Fv(.)p Black 396 728 a Ft(\225)p Black -60 w Fv(F)o(or)20 b(the)g(unary)f(operators)g Fn(subexpr)s -Fq(*)p Fv(,)g Fn(subexpr)s Fq(+)p Fv(,)g(and)g Fn(subexpr)s -Fq(?)p Fv(,)g(the)h Fn(subexpr)i Fv(must)f(not)f(be)g(again)f(an)479 -836 y(unary)g(operator)-5 b(.)479 986 y Fr(Ille)m(gal:)19 -b Fq()p Fv(;)20 b(this)h(must)f(be)g(written)g -(as)h Fq()p Fv(.)p Black 396 -1135 a Ft(\225)p Black 60 w Fv(Between)21 b Fq(\))f Fv(and)g(one)f(of)h -(the)h(unary)d(operatory)g Fq(*)p Fv(,)j Fq(+)p Fv(,)f(or)g -Fq(?)p Fv(,)g(there)g(must)g(not)g(be)g(whitespace.)479 -1285 y Fr(Ille)m(gal:)f Fq()p -Fv(;)21 b(this)f(must)h(be)f(written)g(as)h Fq()p Fv(.)p Black 396 1434 a Ft(\225)p Black -60 w Fv(There)20 b(is)h(the)f(additional)f(constraint)g(that)h(the)h -(right)e(parenthsis)g(must)i(be)f(contained)e(in)j(the)f(same)g(entity) -g(as)h(the)479 1542 y(left)g(parenthesis;)e(see)i(the)f(section)g -(about)f(parsed)h(entities)g(belo)n(w)-5 b(.)396 1733 -y(Note)20 b(that)g(there)g(is)h(another)e(restriction)g(on)h(re)o -(gular)e(e)o(xpressions)h(which)h(must)g(be)g(deterministic.)f(This)h -(means)g(that)396 1841 y(the)g(parser)g(must)g(be)g(able)g(to)h(see)g -(by)e(looking)g(at)i(the)f(ne)o(xt)f(tok)o(en)h(which)f(alternati)n(v)o -(e)g(is)i(actually)f(used,)g(or)f(whether)396 1949 y(the)h(repetition)f -(stops.)i(The)f(reason)f(for)g(this)i(is)g(simply)f(compatability)f -(with)h(SGML)g(\(there)g(is)h(no)f(intrinsic)f(reason)396 -2057 y(for)h(this)h(rule;)e(XML)i(can)f(li)n(v)o(e)g(without)f(this)i -(restriction\).)396 2302 y Fj(Example)479 2449 y Fi(The)e(elements)g -(are)g(declared)h(as)f(follo)n(ws:)479 2620 y Fh()479 2707 y()479 2795 y()479 2882 -y()479 3062 y Fi(This)19 -b(is)f(a)h(le)o(gal)g(instance:)479 3233 y Fh(Some)44 -b(characters<)q(/q>)479 3413 y Fi(\(Note:)19 -b Fg(<)p Fh(s/)p Fg(>)g Fi(is)g(an)g(abbre)n(viation)h(for)f -Fg(<)p Fh(s)p Fg(><)p Fh(/s)p Fg(>)p Fi(.\))g(It)f(w)o(ould)i(be)f -(ille)o(gal)f(to)h(lea)o(v)o(e)g Fh()h Fi(out)f(because)h(at)f -(least)f(one)479 3510 y(instance)i(of)f Fh(s)g Fi(or)g -Fh(t)g Fi(must)g(be)g(present.)g(It)f(w)o(ould)i(be)f(ille)o(gal,)f -(too,)h(if)f(characters)i(e)o(xisted)f(outside)h(the)e -Fh(r)i Fi(element;)f(the)g(only)479 3607 y(e)o(xception)h(is)f(white)g -(space.)g(\226)g(This)f(is)h(le)o(gal,)f(too:)479 3778 -y Fh(<)q(/q>)q()-2 4230 -y Fp(1.2.4.)35 b(Attrib)n(ute)e(lists)h(and)g(A)-11 b(TTLIST)34 -b(dec)n(larations)396 4398 y Fv(Elements)20 b(may)g(ha)n(v)o(e)f -(attrib)n(utes.)h(These)g(are)g(put)g(into)g(the)g(start)h(tag)f(of)g -(an)g(element)g(as)h(follo)n(ws:)396 4578 y Fo(<)p Fn(element-name)43 -b(attribute)1444 4608 y Fk(1)1469 4578 y Fq(=")p Fn(value)1784 -4608 y Fk(1)1810 4578 y Fq(")i(...)f Fn(attribute)2484 -4608 y Fk(n)2509 4578 y Fq(=")p Fn(value)2824 4608 y -Fk(n)2850 4578 y Fq(")p Fo(>)396 4769 y Fv(Instead)20 -b(of)g Fq(")p Fn(value)1017 4799 y Fk(k)1043 4769 y Fq(")g -Fv(it)h(is)g(also)g(possible)f(to)g(use)g(single)g(quotes)g(as)h(in)f -Fq(')p Fn(value)2817 4799 y Fk(k)2843 4769 y Fq(')p Fv(.)g(Note)h(that) -f(you)f(cannot)g(use)396 4877 y(double)g(quotes)h(literally)g(within)g -(the)g(v)n(alue)f(of)h(the)g(attrib)n(ute)g(if)h(double)d(quotes)i(are) -g(the)g(delimiters;)g(the)g(same)p Black 3800 5278 a -Fr(15)p Black eop -%%Page: 16 16 -16 15 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fv(applies)f(to)h(single)f(quotes.)f(Y)-9 -b(ou)20 b(can)g(generally)e(not)i(use)g Fm(<)h Fv(and)e(&)i(as)g -(characters)e(in)h(attrib)n(ute)g(v)n(alues.)g(It)g(is)396 -687 y(possible)g(to)h(include)e(the)h(paraphrases)e(<,)j(>,)f -(&,)f(',)g(and)h(")f(\(and)g(an)o(y)g(other)h(reference)e -(to)j(a)396 795 y(general)e(entity)h(as)h(long)f(as)g(the)h(entity)f -(is)h(not)e(de\002ned)h(by)f(an)i(e)o(xternal)d(\002le\))j(as)g(well)g -(as)g(&#)p Fl(n)p Fv(;.)396 944 y(Before)f(you)f(can)h(use)h(an)f -(attrib)n(ute)g(you)f(must)h(declare)g(it.)g(An)g(A)-9 -b(TTLIST)20 b(declaration)e(looks)i(as)h(follo)n(ws:)396 -1124 y Fo(<)p Fq(!ATTLIST)43 b Fn(element-name)845 1222 -y(attribute-name)f(attribute-type)h(attribute-default)845 -1319 y Fq(...)845 1416 y Fn(attribute-name)f(attribute-type)h -(attribute-default)396 1513 y Fo(>)396 1704 y Fv(There)20 -b(are)g(a)g(lot)h(of)f(types,)f(b)n(ut)i(most)f(important)f(are:)p -Black 396 2061 a Ft(\225)p Black 60 w Fq(CDATA)p Fv(:)h(Ev)o(ery)f -(string)h(is)h(allo)n(wed)f(as)g(attrib)n(ute)g(v)n(alue.)p -Black 396 2169 a Ft(\225)p Black 60 w Fq(NMTOKEN)p Fv(:)g(Ev)o(ery)f -(nametok)o(en)f(is)j(allo)n(wed)f(as)g(attrib)n(ute)g(v)n(alue.)g -(Nametok)o(ens)f(consist)h(\(mainly\))f(of)g(letters,)479 -2277 y(digits,)h(.,)h(:,)f(-,)g(_)h(in)f(arbitrary)f(order)-5 -b(.)p Black 396 2385 a Ft(\225)p Black 60 w Fq(NMTOKENS)p -Fv(:)20 b(A)g(space-separated)f(list)i(of)f(nametok)o(ens)e(is)k(allo)n -(wed)d(as)i(attrib)n(ute)f(v)n(alue.)396 2534 y(The)g(most)g -(interesting)g(def)o(ault)f(declarations)g(are:)p Black -396 2767 a Ft(\225)p Black 60 w Fq(#REQUIRED)p Fv(:)h(The)f(attrib)n -(ute)h(must)g(be)h(speci\002ed.)p Black 396 2874 a Ft(\225)p -Black 60 w Fq(#IMPLIED)p Fv(:)e(The)h(attrib)n(ute)f(can)g(be)h -(speci\002ed)f(b)n(ut)h(also)g(can)f(be)h(left)g(out.)f(The)g -(application)g(can)g(\002nd)g(out)h(whether)479 2982 -y(the)g(attrib)n(ute)g(w)o(as)h(present)f(or)g(not.)p -Black 396 3090 a Ft(\225)p Black 60 w Fq(")p Fn(value)p -Fq(")g Fv(or)f Fq(')p Fn(value)p Fq(')p Fv(:)h(This)g(particular)e(v)n -(alue)i(is)g(used)g(as)h(def)o(ault)e(if)h(the)g(attrib)n(ute)g(is)g -(omitted)g(in)g(the)g(element.)396 3378 y Fj(Example)479 -3525 y Fi(This)f(is)f(a)h(v)n(alid)g(attrib)o(ute)g(declaration)g(for)g -(element)g(type)h Fh(r)p Fi(:)479 3695 y Fh()479 4137 y Fi(This)19 b(means)g(that)g Fh(x)g -Fi(is)g(a)g(required)g(attrib)o(ute)f(that)h(cannot)h(be)f(left)g(out,) -f(while)h Fh(y)g Fi(and)h Fh(z)f Fi(are)g(optional.)g(The)g(XML)g -(parser)479 4235 y(indicates)h(the)f(application)g(whether)h -Fh(y)f Fi(is)f(present)i(or)f(not,)f(b)o(ut)h(if)f Fh(z)h -Fi(is)g(missing)g(the)g(def)o(ault)h(v)n(alue)f("one)h(tw)o(o)f(three") -h(is)479 4332 y(returned)g(automatically)-5 b(.)479 4470 -y(This)19 b(is)f(a)h(v)n(alid)g(e)o(xample)h(of)f(these)g(attrib)o -(utes:)479 4641 y Fh()p Black 3798 5278 a Fr(16)p -Black eop -%%Page: 17 17 -17 16 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black -2 583 a Fp(1.2.5.)35 b(P)l(ar)n(sed)g(entities)396 -751 y Fv(Elements)20 b(describe)f(the)i(logical)e(structure)h(of)g(the) -g(document,)e(while)i Fr(entities)g Fv(determine)f(the)h(physical)g -(structure.)396 859 y(Entities)h(are)f(the)g(pieces)g(of)g(te)o(xt)g -(the)g(parser)g(operates)f(on,)h(mostly)g(\002les)h(and)f(macros.)f -(Entities)h(may)g(be)g Fr(par)o(sed)i Fv(in)396 967 y(which)e(case)h -(the)f(parser)f(reads)h(the)g(te)o(xt)h(and)e(interprets)g(it)i(as)g -(XML)g(markup,)d(or)i Fr(unpar)o(sed)h Fv(which)e(simply)h(means)396 -1075 y(that)h(the)f(data)g(of)g(the)g(entity)g(has)g(a)h(foreign)d -(format)h(\(e.g.)h(a)g(GIF)h(icon\).)396 1224 y(If)f(the)g(parsed)f -(entity)g(is)i(going)e(to)h(be)g(used)f(as)i(part)e(of)h(the)g(DTD,)g -(it)g(is)h(called)f(a)g Fr(par)o(ameter)f(entity)p Fv(.)h(Y)-9 -b(ou)19 b(can)h(declare)396 1332 y(a)h(parameter)e(entity)g(with)i(a)f -(\002x)o(ed)g(te)o(xt)g(as)h(content)e(by:)396 1512 y -Fo(<)p Fq(!ENTITY)44 b(\045)g Fn(name)g Fq(")p Fn(value)p -Fq(")p Fo(>)396 1703 y Fv(W)m(ithin)20 b(the)h(DTD,)f(you)f(can)h -Fr(r)m(efer)h(to)f Fv(this)h(entity)-5 b(,)19 b(i.e.)i(read)e(the)h(te) -o(xt)g(of)g(the)h(entity)-5 b(,)19 b(by:)396 1883 y Fq(\045)p -Fn(name)p Fq(;)396 2074 y Fv(Such)h(entities)h(beha)n(v)o(e)e(lik)o(e)h -(macros,)f(i.e.)i(when)e(the)o(y)h(are)g(referred)e(to,)i(the)g(macro)g -(te)o(xt)g(is)h(inserted)e(and)h(read)396 2182 y(instead)g(of)g(the)g -(original)f(te)o(xt.)396 2478 y Fj(Example)479 2625 y -Fi(F)o(or)g(e)o(xample,)g(you)h(can)f(declare)h(tw)o(o)f(elements)g -(with)f(the)h(same)h(content)f(model)h(by:)479 2795 y -Fh()479 -2882 y()479 2970 y()396 3202 y Fv(If)20 b(the)h(contents)e(of)h(the)g -(entity)g(are)g(gi)n(v)o(en)f(as)i(string)f(constant,)f(the)h(entity)g -(is)h(called)f(an)g Fr(internal)g Fv(entity)-5 b(.)19 -b(It)i(is)g(also)396 3310 y(possible)f(to)h(name)e(a)i(\002le)g(to)f -(be)g(used)g(as)h(content)e(\(an)h Fr(e)n(xternal)g Fv(entity\):)396 -3490 y Fo(<)p Fq(!ENTITY)44 b(\045)g Fn(name)g Fq(SYSTEM)g(")p -Fn(file)g(name)p Fq(")p Fo(>)396 3681 y Fv(There)20 b(are)g(some)g -(restrictions)f(for)h(parameter)f(entities:)p Black 396 -4038 a Ft(\225)p Black 60 w Fv(If)h(the)h(internal)e(parameter)g -(entity)g(contains)h(the)g(\002rst)h(tok)o(en)e(of)h(a)h(declaration)e -(\(i.e.)g Fo(<)p Fq(!)p Fv(\),)h(it)h(must)f(also)h(contain)479 -4146 y(the)f(last)i(tok)o(en)d(of)h(the)g(declaration,)e(i.e.)j(the)f -Fo(>)p Fv(.)g(This)g(means)g(that)h(the)f(entity)g(either)g(contains)f -(a)i(whole)e(number)479 4254 y(of)h(complete)f(declarations,)g(or)h -(some)g(te)o(xt)g(from)f(the)h(middle)g(of)g(one)f(declaration.)479 -4404 y Fr(Ille)m(gal:)479 4542 y Fq(">)479 4639 y()j Fv(is)h(contained)e(in)h(the)h(entity)e Fq(e)p -Fv(.)p Black 3797 5278 a Fr(17)p Black eop -%%Page: 18 18 -18 17 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black Black 396 579 a Ft(\225)p Black 60 w Fv(If)f(the)h(internal)e -(parameter)g(entity)g(contains)h(a)h(left)f(paranthesis,)f(it)i(must)f -(also)h(contain)e(the)h(corresponding)d(right)479 687 -y(paranthesis.)479 836 y Fr(Ille)m(gal:)479 975 y Fq()479 1072 y()479 1222 y Fv(Because)21 b Fq(\()f Fv(is)h(contained)e(in)h -(the)g(entity)g Fq(e)p Fv(,)h(and)e(the)i(corresponding)16 -b Fq(\))21 b Fv(is)g(contained)e(in)h(the)g(main)g(entity)-5 -b(.)p Black 396 1371 a Ft(\225)p Black 60 w Fv(When)20 -b(reading)e(te)o(xt)i(from)f(an)g(entity)-5 b(,)19 b(the)h(parser)f -(automatically)f(inserts)i(one)g(space)f(character)g(before)f(the)i -(entity)479 1479 y(te)o(xt)g(and)g(one)g(space)g(character)f(after)h -(the)g(entity)g(te)o(xt.)f(Ho)n(we)n(v)o(er)m(,)f(this)j(rule)f(is)h -(not)f(applied)f(within)h(the)g(de\002nition)479 1587 -y(of)g(another)f(entity)-5 b(.)479 1736 y Fr(Le)m(gal:)479 -1875 y Fq()479 1972 -y()479 2121 -y Fv(Because)21 b Fq(\045suffix;)e Fv(is)i(referenced)d(within)i(the)g -(de\002nition)f(te)o(xt)h(for)g Fq(iconfile)p Fv(,)f(no)h(additional)f -(spaces)h(are)479 2229 y(added.)479 2379 y Fr(Ille)m(gal:)479 -2517 y Fq()479 2615 -y()479 2764 y Fv(Because)21 -b Fq(\045suffix;)e Fv(is)i(referenced)d(outside)i(the)g(de\002nition)f -(te)o(xt)h(of)g(another)f(entity)-5 b(,)19 b(the)h(parser)g(replaces) -479 2872 y Fq(\045suffix;)g Fv(by)f Fn(space)p Fq(test)p -Fn(space)p Fv(.)479 3021 y Fr(Ille)m(gal:)479 3160 y -Fq()479 -3257 y()479 3407 y Fv(Because)21 -b(there)e(is)j(a)e(whitespace)g(between)f Fq(\))i Fv(and)e -Fq(*)p Fv(,)i(which)e(is)i(ille)o(gal.)p Black 396 3556 -a Ft(\225)p Black 60 w Fv(An)f(e)o(xternal)f(parameter)g(entity)h(must) -g(al)o(w)o(ays)h(consist)f(of)g(a)h(whole)e(number)g(of)h(complete)f -(declarations.)p Black 396 3664 a Ft(\225)p Black 60 -w Fv(In)h(the)g(internal)g(subset)g(of)g(the)g(DTD,)g(a)h(reference)d -(to)j(a)f(parameter)f(entity)h(\(internal)f(or)h(e)o(xternal\))e(is)k -(only)479 3772 y(allo)n(wed)e(at)h(positions)e(where)h(a)g(ne)n(w)g -(declaration)f(can)h(start.)396 3963 y(If)g(the)f(parsed)g(entity)g(is) -h(going)e(to)i(be)f(used)g(in)h(the)f(document)e(instance,)i(it)h(is)h -(called)e(a)h Fr(g)o(ener)o(al)e(entity)p Fv(.)h(Such)g(entities)396 -4071 y(can)h(be)g(used)g(as)h(abbre)n(viations)d(for)i(frequent)e -(phrases,)i(or)g(to)g(include)f(e)o(xternal)g(\002les.)i(Internal)e -(general)g(entities)i(are)396 4179 y(declared)e(as)i(follo)n(ws:)396 -4359 y Fo(<)p Fq(!ENTITY)44 b Fn(name)g Fq(")p Fn(value)p -Fq(")p Fo(>)396 4550 y Fv(External)19 b(general)g(entities)i(are)f -(declared)f(this)i(w)o(ay:)396 4730 y Fo(<)p Fq(!ENTITY)44 -b Fn(name)g Fq(SYSTEM)g(")p Fn(file)g(name)p Fq(")p Fo(>)p -Black 3800 5278 a Fr(18)p Black eop -%%Page: 19 19 -19 18 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fv(References)f(to)g(general)f(entities)i(are)f -(written)g(as:)396 759 y Fq(&)p Fn(name)p Fq(;)396 950 -y Fv(The)g(main)g(dif)n(ference)e(between)h(parameter)g(and)h(general)f -(entities)h(is)i(that)e(the)g(former)f(are)h(only)f(recognized)f(in)j -(the)396 1058 y(DTD)g(and)e(that)i(the)f(latter)g(are)g(only)g -(recognized)e(in)i(the)g(document)e(instance.)i(As)h(the)f(DTD)g(is)i -(parsed)d(before)g(the)396 1166 y(document,)f(the)i(parameter)f -(entities)i(are)f(e)o(xpanded)d(\002rst;)k(for)f(e)o(xample)f(it)i(is)g -(possible)f(to)g(use)h(the)f(content)f(of)h(a)396 1274 -y(parameter)f(entity)h(as)h(the)f(name)g(of)f(a)i(general)e(entity:)h -Fq(&\045name;;)2557 1241 y Ff(1)2580 1274 y Fv(.)396 -1423 y(General)g(entities)g(must)h(respect)e(the)i(element)e(hierarchy) --5 b(.)17 b(This)k(means)f(that)g(there)g(must)g(be)g(an)g(end)g(tag)g -(for)g(e)n(v)o(ery)396 1531 y(start)h(tag)f(in)h(the)f(entity)g(v)n -(alue,)f(and)h(that)g(end)f(tags)i(without)e(corresponding)e(start)k -(tags)f(are)g(not)g(allo)n(wed.)396 1777 y Fj(Example)479 -1924 y Fi(If)f(the)f(author)i(of)f(a)f(document)j(changes)f(sometimes,) -f(it)f(is)g(w)o(orthwhile)h(to)g(set)f(up)i(a)e(general)i(entity)e -(containing)i(the)f(names)479 2021 y(of)g(the)g(authors.)h(If)e(the)h -(author)h(changes,)g(you)f(need)h(only)g(to)e(change)j(the)e -(de\002nition)g(of)g(the)g(entity)-5 b(,)18 b(and)i(do)f(not)h(need)f -(to)479 2118 y(check)h(all)f(occurrences)h(of)f(authors')h(names:)479 -2289 y Fh()479 -2469 y Fi(In)19 b(the)g(document)i(te)o(xt,)d(you)i(can)f(no)n(w)h -(refer)e(to)h(the)g(author)h(names)f(by)h(writing)e Fh(&authors;)p -Fi(.)479 2607 y Fe(Ille)m(gal:)h Fi(The)g(follo)n(wing)g(tw)o(o)g -(entities)g(are)g(ille)o(gal)f(because)i(the)f(elements)g(in)g(the)g -(de\002nition)g(do)g(not)h(nest)f(properly:)479 2778 -y Fh()q(">)479 2865 y(">)396 3139 y Fv(Earlier)20 b(in)g(this)h(introduction)d(we)i -(e)o(xplained)e(that)j(there)e(are)i(substitutes)f(for)g(reserv)o(ed)e -(characters:)i(<,)g(>,)396 3247 y(&,)f(',)h(and)f -(".)g(These)h(are)g(simply)g(prede\002ned)e(general)h(entities;)i -(note)f(that)g(the)o(y)g(are)g(the)g(only)396 3355 y(prede\002ned)e -(entities.)j(It)f(is)h(allo)n(wed)f(to)g(de\002ne)g(these)g(entities)h -(again)e(as)i(long)e(as)i(the)f(meaning)f(is)i(unchanged.)-2 -3725 y Fp(1.2.6.)35 b(Notations)g(and)e(unpar)n(sed)i(entities)396 -3892 y Fv(Unparsed)19 b(entities)i(ha)n(v)o(e)e(a)i(foreign)d(format)i -(and)f(can)h(thus)g(not)g(be)g(read)g(by)g(the)g(XML)g(parser)-5 -b(.)20 b(Unparsed)f(entities)396 4000 y(are)h(al)o(w)o(ays)h(e)o -(xternal.)e(The)h(format)f(of)h(an)g(unparsed)e(entity)i(must)g(ha)n(v) -o(e)g(been)f(declared,)g(such)h(a)h(format)e(is)i(called)f(a)396 -4108 y Fr(notation)p Fv(.)f(The)g(entity)h(can)g(then)g(be)g(declared)f -(by)h(referring)e(to)i(this)h(notation.)e(As)i(unparsed)d(entities)j -(do)f(not)396 4216 y(contain)f(XML)i(te)o(xt,)e(it)i(is)h(not)d -(possible)h(to)h(include)e(them)h(directly)f(into)h(the)g(document;)e -(you)i(can)g(only)f(declare)396 4324 y(attrib)n(utes)h(such)g(that)h -(names)e(of)h(unparsed)f(entities)h(are)h(acceptable)e(v)n(alues.)396 -4474 y(As)i(you)f(can)g(see,)g(unparsed)f(entities)h(are)g(too)g -(complicated)f(in)h(order)f(to)h(ha)n(v)o(e)g(an)o(y)f(purpose.)g(It)h -(is)h(almost)f(al)o(w)o(ays)396 4581 y(better)g(to)g(simply)g(pass)h -(the)f(name)g(of)g(the)g(data)g(\002le)h(as)g(normal)e(attrib)n(ute)g -(v)n(alue,)h(and)f(let)i(the)f(application)f(recognize)396 -4689 y(and)h(process)g(the)g(foreign)e(format.)p Black -3800 5278 a Fr(19)p Black eop -%%Page: 20 20 -20 19 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black -2 597 a Fx(1.3.)39 b(A)g(complete)f(e)n(xample:)g(The)h -Fd(readme)k Fx(DTD)396 777 y Fv(The)20 b(reason)g(for)f -Fr(r)m(eadme)h Fv(w)o(as)h(that)f(I)g(often)g(wrote)g(tw)o(o)g(v)o -(ersions)f(of)h(\002les)h(such)f(as)h(README)g(and)e(INST)-8 -b(ALL)396 885 y(which)20 b(e)o(xplain)f(aspects)h(of)g(a)h(distrib)n -(uted)e(softw)o(are)h(archi)n(v)o(e;)f(one)g(v)o(ersion)g(w)o(as)i -(ASCII-formatted,)d(the)i(other)g(w)o(as)396 993 y(written)g(in)h -(HTML.)e(Maintaining)g(both)g(v)o(ersions)h(means)f(double)g(amount)g -(of)h(w)o(ork,)f(and)h(changes)f(of)h(one)f(v)o(ersion)396 -1101 y(may)h(be)g(for)o(gotten)e(in)i(the)g(other)f(v)o(ersion.)g(T)-7 -b(o)20 b(impro)o(v)o(e)e(this)j(situation)e(I)i(in)m(v)o(ented)d(the)i -Fr(r)m(eadme)g Fv(DTD)g(which)f(allo)n(ws)396 1209 y(me)h(to)h -(maintain)e(only)h(one)f(source)h(written)g(as)g(XML)h(document,)d(and) -h(to)i(generate)e(the)h(ASCII)g(and)g(the)g(HTML)396 -1317 y(v)o(ersion)f(from)g(it.)396 1466 y(In)h(this)h(section,)f(I)g(e) -o(xplain)f(only)g(the)i(DTD.)f(The)f Fr(r)m(eadme)h Fv(DTD)h(is)g -(contained)d(in)j(the)f(PXP)h(distrib)n(ution)e(together)396 -1574 y(with)i(the)f(tw)o(o)g(con)m(v)o(erters)e(to)j(produce)d(ASCII)i -(and)g(HTML.)g(Another)e(section)i(of)g(this)h(manual)e(describes)h -(the)396 1682 y(HTML)g(con)m(v)o(erter)-5 b(.)396 1831 -y(The)20 b(documents)f(ha)n(v)o(e)g(a)i(simple)f(structure:)f(There)h -(are)g(up)g(to)g(three)g(le)n(v)o(els)g(of)g(nested)g(sections,)g -(paragraphs,)d(item)396 1939 y(lists,)22 b(footnotes,)c(hyperlinks,)g -(and)h(te)o(xt)h(emphasis.)g(The)g(outermost)f(element)g(has)i(usually) -e(the)h(type)g Fq(readme)p Fv(,)g(it)h(is)396 2047 y(declared)e(by)396 -2228 y Fq()396 2325 -y()396 -2613 y Fv(This)21 b(means)f(that)g(this)h(element)e(contains)h(one)f -(or)h(more)f(sections)i(of)f(the)g(\002rst)h(le)n(v)o(el)f(\(element)f -(type)h Fq(sect1)p Fv(\),)f(and)396 2721 y(that)i(the)f(element)f(has)i -(a)f(required)f(attrib)n(ute)h Fq(title)f Fv(containing)g(character)g -(data)h(\(CD)m(A)-9 b(T)h(A\).)19 b(Note)h(that)h Fq(readme)396 -2829 y Fv(elements)f(must)g(not)g(contain)f(te)o(xt)h(data.)396 -2978 y(The)g(three)g(le)n(v)o(els)g(of)g(sections)g(are)g(declared)f -(as)i(follo)n(ws:)396 3158 y Fq()396 3352 y()396 3547 y()396 3738 y Fv(Ev)o(ery)19 b(section)h(has)g(a)h -Fq(title)f Fv(element)g(as)g(\002rst)h(subelement.)e(After)h(the)g -(title)h(an)f(arbitrary)f(b)n(ut)h(non-empty)396 3846 -y(sequence)f(of)h(inner)g(sections,)g(paragraphs)e(and)h(item)i(lists)g -(follo)n(ws.)f(Note)g(that)g(the)g(inner)g(sections)g(must)g(belong)f -(to)396 3954 y(the)h(ne)o(xt)g(higher)f(section)h(le)n(v)o(el;)g -Fq(sect3)g Fv(elements)f(must)i(not)f(contain)f(inner)g(sections)h -(because)g(there)g(is)h(no)e(ne)o(xt)396 4061 y(higher)g(le)n(v)o(el.) -396 4211 y(Ob)o(viously)-5 b(,)18 b(all)j(three)f(declarations)e(allo)n -(w)j(paragraphs)d(\()p Fq(p)p Fv(\))h(and)h(item)g(lists)i(\()p -Fq(ul)p Fv(\).)e(The)f(de\002nition)g(can)h(be)396 4319 -y(simpli\002ed)g(at)h(this)g(point)e(by)h(using)f(a)i(parameter)e -(entity:)396 4499 y Fq()396 -4693 y()p -Black 3800 5278 a Fr(20)p Black eop -%%Page: 21 21 -21 20 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fq()396 773 y()396 964 y Fv(Here,)20 b(the)g(entity)g -Fq(p.like)g Fv(is)h(nothing)e(b)n(ut)h(a)g(macro)g(abbre)n(viating)d -(the)j(same)h(sequence)e(of)h(declarations;)f(if)h(ne)n(w)396 -1072 y(elements)f(on)h(the)f(same)h(le)n(v)o(el)f(as)h -Fq(p)g Fv(and)f Fq(ul)h Fv(are)f(later)h(added,)e(it)i(is)h(suf)n -(\002cient)e(only)f(to)i(change)e(the)i(entity)f(de\002nition.)396 -1180 y(Note)h(that)h(there)e(are)i(some)f(restrictions)f(on)h(the)g -(usage)g(of)g(entities)h(in)f(this)h(conte)o(xt;)e(most)h(important,)e -(entities)396 1288 y(containing)h(a)h(left)h(paranthesis)e(must)h(also) -h(contain)e(the)h(corresponding)d(right)i(paranthesis.)396 -1437 y(Note)h(that)h(the)f(entity)g Fq(p.like)g Fv(is)h(a)f -Fr(par)o(ameter)i Fv(entity)-5 b(,)19 b(i.e.)h(the)g(ENTITY)g -(declaration)e(contains)i(a)g(percent)f(sign,)396 1545 -y(and)h(the)g(entity)g(is)h(referred)e(to)h(by)g Fq(\045p.like;)p -Fv(.)f(This)h(kind)g(of)f(entity)h(must)h(be)f(used)g(to)g(abbre)n -(viate)e(parts)j(of)f(the)396 1653 y(DTD;)g(the)g Fr(g)o(ener)o(al)f -Fv(entities)h(declared)e(without)h(percent)g(sign)h(and)f(referred)f -(to)i(as)g Fq(&name;)f Fv(are)h(not)f(allo)n(wed)g(in)h(this)396 -1761 y(conte)o(xt.)396 1911 y(The)g Fq(title)g Fv(element)g -(speci\002es)g(the)h(title)f(of)g(the)h(section)f(in)g(which)g(it)g -(occurs.)g(The)f(title)i(is)h(gi)n(v)o(en)c(as)j(character)396 -2019 y(data,)f(optionally)f(interspersed)f(with)j(line)f(breaks)g(\()p -Fq(br)p Fv(\):)396 2199 y Fq() -396 2390 y Fv(Compared)19 b(with)h(the)g Fq(title)g Fr(attrib)n(ute)g -Fv(of)g(the)h Fq(readme)e Fv(element,)h(this)g(element)g(allo)n(ws)g -(inner)g(markup)e(\(i.e.)i Fq(br)p Fv(\))396 2498 y(while)g(attrib)n -(ute)g(v)n(alues)g(do)g(not:)g(It)g(is)h(an)g(error)e(if)h(an)g(attrib) -n(ute)g(v)n(alue)g(contains)f(the)h(left)h(angle)e(brack)o(et)g -Fm(<)i Fv(literally)396 2605 y(such)f(that)g(it)h(is)h(impossible)d(to) -h(include)g(inner)f(elements.)396 2755 y(The)h(paragraph)e(element)h -Fq(p)i Fv(has)f(a)h(structure)e(similar)i(to)f Fq(title)p -Fv(,)g(b)n(ut)g(it)h(allo)n(ws)f(more)g(inner)f(elements:)396 -2935 y Fq()396 -3129 y()396 3320 -y Fv(Line)20 b(breaks)g(do)f(not)h(ha)n(v)o(e)g(inner)f(structure,)g -(so)i(the)o(y)e(are)h(declared)f(as)i(being)e(empty:)396 -3500 y Fq()396 3691 y Fv(This)21 -b(means)f(that)g(really)g(nothing)e(is)j(allo)n(wed)f(within)g -Fq(br)p Fv(;)g(you)f(must)i(al)o(w)o(ays)f(write)h Fq(

)e -Fv(or)h(abbre)n(viated)396 3799 y Fq(
)p Fv(.)396 -3949 y(Code)g(samples)h(should)e(be)h(mark)o(ed)f(up)h(by)f(the)h -Fq(code)h Fv(tag;)f(emphasized)f(te)o(xt)h(can)g(be)g(indicated)f(by)h -Fq(em)p Fv(:)396 4129 y Fq()396 -4323 y()396 4514 -y Fv(That)20 b Fq(code)g Fv(elements)g(are)g(not)g(allo)n(wed)g(to)g -(contain)f(further)g(markup)f(while)i Fq(em)h Fv(elements)f(do)g(is)h -(a)f(design)g(decision)396 4622 y(by)g(the)g(author)f(of)h(the)g(DTD.) -396 4772 y(Unordered)e(lists)k(simply)d(consists)i(of)f(one)g(or)g -(more)f(list)i(items,)g(and)e(a)i(list)g(item)g(may)e(contain)g -(paragraph-le)n(v)o(el)396 4879 y(material:)p Black 3800 -5278 a Fr(21)p Black eop -%%Page: 22 22 -22 21 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 396 579 a Fq()396 773 -y()396 964 y Fv(F)o(ootnotes)19 -b(are)h(described)f(by)h(the)g(te)o(xt)g(of)g(the)g(note;)g(this)h(te)o -(xt)f(may)g(contain)f(te)o(xt-le)n(v)o(el)g(markup.)f(There)h(is)i(no) -396 1072 y(mechanism)e(to)i(describe)e(the)h(numbering)e(scheme)h(of)h -(footnotes,)f(or)h(to)g(specify)g(ho)n(w)f(footnote)g(references)f(are) -396 1180 y(printed.)396 1360 y Fq()396 1551 y Fv(Hyperlinks)19 -b(are)h(written)g(as)h(in)f(HTML.)g(The)g(anchor)f(tag)h(contains)f -(the)h(te)o(xt)g(describing)f(where)h(the)g(link)g(points)g(to,)396 -1659 y(and)g(the)g Fq(href)g Fv(attrib)n(ute)g(is)h(the)f(pointer)f -(\(as)i(URL\).)f(There)f(is)j(no)d(w)o(ay)i(to)f(describe)f(locations)h -(of)g("hash)g(marks".)f(If)396 1767 y(the)h(link)g(refers)g(to)g -(another)f Fr(r)m(eadme)h Fv(document,)e(the)i(attrib)n(ute)g -Fq(readmeref)f Fv(should)g(be)h(used)g(instead)g(of)g -Fq(href)p Fv(.)396 1875 y(The)g(reason)g(is)h(that)f(the)g(con)m(v)o -(erted)e(document)g(has)i(usually)g(a)h(dif)n(ferent)d(system)i -(identi\002er)g(\(\002le)h(name\),)d(and)i(the)396 1983 -y(link)g(to)h(a)f(con)m(v)o(erted)e(document)g(must)i(be)g(con)m(v)o -(erted,)e(too.)396 2163 y Fq()396 -2260 y()396 -2742 y Fv(Note)20 b(that)h(although)d(it)j(is)g(only)e(sensible)i(to)f -(specify)g(one)f(of)h(the)g(tw)o(o)h(attrib)n(utes,)f(the)g(DTD)g(has)h -(no)e(means)h(to)396 2850 y(e)o(xpress)g(this)g(restriction.)396 -3000 y(So)h(f)o(ar)f(the)g(DTD.)g(Finally)-5 b(,)19 b(here)h(is)h(a)g -(document)d(for)i(it:)396 3180 y Fq()396 3277 y()396 3374 y()396 3471 y()486 3569 y -(Usage)486 3666 y(

)576 3763 y(The)g(readme)e -(converter)i(is)g(invoked)g(on)g(the)h(command)e(line)h(by:)486 -3860 y(

)486 3957 y(

)576 4054 y(readme)e([)j(-text)f(|)h -(-html)f(])g(input.xml)486 4151 y(

)486 4248 -y(

)576 4346 y(Here)g(a)g(list)h(of)f(options:)486 -4443 y(

)486 4540 y(
    )576 4637 y(
  • )665 4734 -y(

    -)396 4831 y(text:)f(specifies)g(that)i(ASCII)f -(output)f(should)h(be)h(produced

    )p Black 3800 5278 -a Fr(22)p Black eop -%%Page: 23 23 -23 22 bop Black 3028 67 a Fr(Chapter)19 b(1.)h(What)h(is)g(XML?)p -Black 576 579 a Fq(
  • )576 676 y(
  • )665 773 y(

    -)396 -870 y(html:)43 b(specifies)g(that)i(HTML)f(output)g(should)f(be) -i(produced

    )576 967 y(
  • )486 1065 y(
)486 1162 -y(

)576 1259 y(The)f(input)g(file)g(must)g(be)h(given)f(on)g(the)h -(command)e(line.)h(The)h(converted)e(output)h(is)576 -1356 y(printed)f(to)i(stdout.)486 1453 y(

)396 -1550 y()396 1647 y()486 1745 y(Author)486 -1842 y(

)576 1939 y(The)f(program)g(has)g(been)g(written)g(by)576 -2036 y(Ge) -o(rd)39 b(Stolpmann.)486 2133 y(

)396 2230 y(
)396 -2327 y()-2 2746 y Fx(Notes)p Black 396 2926 -a Fv(1.)p Black 70 w(This)20 b(construct)g(is)h(only)e(allo)n(wed)h -(within)g(the)g(de\002nition)f(of)h(another)e(entity;)i(otherwise)g(e)o -(xtra)f(spaces)i(w)o(ould)529 3034 y(be)f(added)f(\(as)i(e)o(xplained)d -(abo)o(v)o(e\).)g(Such)i(indirection)e(is)j(not)f(recommended.)529 -3172 y Fi(Complete)f(e)o(xample:)529 3343 y Fh()243 b()529 -3430 y()529 -3518 y()529 -3605 y()529 -3785 y Fi(Y)-8 b(ou)19 b(can)h(no)n(w)f(write)f Fh(&text;)j -Fi(in)e(the)g(document)h(instance,)f(and)h(depending)h(on)e(the)g(v)n -(alue)g(of)g Fh(variant)i Fi(either)e Fh(text-a)i Fi(or)529 -3882 y Fh(text-b)g Fi(is)d(inserted.)p Black 3800 5278 -a Fr(23)p Black eop -%%Page: 24 24 -24 23 bop Black Black -2 621 a Fs(Chapter)48 b(2.)f(Using)i(PXP)-2 -1055 y Fx(2.1.)39 b(V)-9 b(alidation)396 1235 y Fv(The)20 -b(parser)g(can)g(be)g(used)g(to)g Fr(validate)f Fv(a)i(document.)d -(This)i(means)g(that)g(all)h(the)f(constraints)g(that)g(must)g(hold)g -(for)f(a)396 1343 y(v)n(alid)h(document)e(are)i(actually)g(check)o(ed.) -f(V)-9 b(alidation)19 b(is)i(the)f(def)o(ault)f(mode)h(of)g(PXP,)g -(i.e.)h(e)n(v)o(ery)d(document)h(is)396 1451 y(v)n(alidated)g(while)i -(it)f(is)i(being)d(parsed.)396 1600 y(In)h(the)g Fq(examples)g -Fv(directory)e(of)i(the)g(distrib)n(ution)f(you)h(\002nd)g(the)g -Fq(pxpvalidate)f Fv(application.)f(It)j(is)g(in)m(v)n(ok)o(ed)d(in)j -(the)396 1708 y(follo)n(wing)e(w)o(ay:)396 1888 y Fq(pxpvalidate)43 -b([)i(-wf)f(])h Fn(file)p Fq(...)396 2079 y Fv(The)20 -b(\002les)h(mentioned)e(on)g(the)i(command)d(line)i(are)g(v)n -(alidated,)f(and)h(e)n(v)o(ery)e(w)o(arning)h(and)h(e)n(v)o(ery)f -(error)g(messages)h(are)396 2187 y(printed)f(to)i(stderr)-5 -b(.)396 2337 y(The)20 b(-wf)g(switch)h(modi\002es)e(the)i(beha)n(viour) -d(such)i(that)g(a)h(well-formedness)d(parser)h(is)i(simulated.)f(In)g -(this)g(mode,)f(the)396 2445 y(ELEMENT)-6 b(,)19 b(A)-9 -b(TTLIST)j(,)19 b(and)g(NO)m(T)-8 b(A)f(TION)20 b(declarations)f(of)h -(the)g(DTD)g(are)g(ignored,)e(and)i(only)f(the)i(ENTITY)396 -2553 y(declarations)e(will)i(tak)o(e)f(ef)n(fect.)g(This)g(mode)f(is)i -(intended)e(for)h(documents)e(lacking)h(a)i(DTD.)f(Please)h(note)f -(that)g(the)396 2661 y(parser)g(still)h(scans)g(the)f(DTD)g(fully)g -(and)g(will)h(report)e(all)h(errors)g(in)g(the)g(DTD;)h(such)f(checks)f -(are)h(not)g(required)f(by)g(a)396 2769 y(well-formedness)f(parser)-5 -b(.)396 2918 y(The)20 b Fq(pxpvalidate)f Fv(application)g(is)i(the)f -(simplest)h(sensible)f(program)e(using)i(PXP,)g(you)g(may)f(consider)g -(it)i(as)396 3026 y("hello)f(w)o(orld")f(program.)-2 -3445 y Fx(2.2.)39 b(Ho)n(w)g(to)g(par)n(se)f(a)i(document)d(fr)m(om)i -(an)g(application)396 3624 y Fv(Let)21 b(me)f(\002rst)h(gi)n(v)o(e)e(a) -i(rough)d(o)o(v)o(ervie)n(w)g(of)i(the)h(object)e(model)g(of)h(the)h -(parser)-5 b(.)19 b(The)h(follo)n(wing)f(items)h(are)h(represented)396 -3732 y(by)f(objects:)p Black 396 4055 a Ft(\225)p Black -60 w Fr(Documents:)f Fv(The)h(document)e(representation)g(is)j(more)e -(or)h(less)h(the)f(anchor)f(for)g(the)h(application;)f(all)i(accesses)g -(to)479 4163 y(the)f(parsed)g(entities)h(start)f(here.)g(It)g(is)h -(described)e(by)h(the)g(class)h Fq(document)f Fv(contained)e(in)j(the)f -(module)479 4271 y Fq(Pxp_document)p Fv(.)f(Y)-9 b(ou)19 -b(can)h(get)h(some)f(global)f(information,)e(such)j(as)h(the)f(XML)h -(declaration)d(the)j(document)479 4379 y(be)o(gins)f(with,)g(the)g(DTD) -g(of)g(the)g(document,)e(global)i(processing)e(instructions,)h(and)h -(most)g(important,)f(the)479 4487 y(document)f(tree.)p -Black 396 4595 a Ft(\225)p Black 60 w Fr(The)j(contents)e(of)h -(documents:)f Fv(The)h(contents)f(ha)n(v)o(e)h(the)g(structure)f(of)h -(a)h(tree:)f(Elements)g(contain)f(other)g(elements)479 -4703 y(and)h(te)o(xt)744 4670 y Ff(1)768 4703 y Fv(.)h(The)e(common)g -(type)h(to)g(represent)f(both)g(kinds)h(of)g(content)f(is)i -Fq(node)f Fv(which)g(is)h(a)g(class)g(type)e(that)479 -4811 y(uni\002es)h(the)h(properties)d(of)i(elements)g(and)g(character)f -(data.)h(Ev)o(ery)e(node)i(has)g(a)h(list)g(of)f(children)f(\(which)g -(is)i(empty)p Black 3800 5278 a Fr(24)p Black eop -%%Page: 25 25 -25 24 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 479 579 a Fv(if)h(the)f(element)g(is)h(empty)e(or)h(the)g(node)f -(represents)h(te)o(xt\);)f(nodes)h(may)g(ha)n(v)o(e)f(attrib)n(utes;)h -(nodes)g(ha)n(v)o(e)f(al)o(w)o(ays)i(te)o(xt)479 687 -y(contents.)d(There)g(are)g(tw)o(o)h(implementations)e(of)h -Fq(node)p Fv(,)h(the)f(class)i Fq(element_impl)d Fv(for)h(elements,)g -(and)g(the)h(class)479 795 y Fq(data_impl)h Fv(for)f(te)o(xt)h(data.)g -(Y)-9 b(ou)20 b(\002nd)f(these)i(classes)g(and)f(class)h(types)f(in)g -(the)g(module)f Fq(Pxp_document)p Fv(,)g(too.)479 944 -y(Note)h(that)h(attrib)n(ute)f(lists)h(are)f(represented)f(by)g -(non-class)h(v)n(alues.)p Black 396 1094 a Ft(\225)p -Black 60 w Fr(The)h(node)e(e)n(xtension:)g Fv(F)o(or)h(adv)n(anced)e -(usage,)i(e)n(v)o(ery)e(node)i(of)f(the)i(document)d(may)i(ha)n(v)o(e)f -(an)h(associated)479 1202 y Fr(e)n(xtension)g Fv(which)g(is)h(simply)f -(a)g(second)f(object.)h(This)g(object)g(must)g(ha)n(v)o(e)g(the)g -(three)g(methods)f Fq(clone)p Fv(,)g Fq(node)p Fv(,)h(and)479 -1310 y Fq(set_node)f Fv(as)h(bare)f(minimum,)e(b)n(ut)j(you)e(are)i -(free)e(to)i(add)f(methods)f(as)i(you)f(w)o(ant.)g(This)g(is)i(the)e -(preferred)e(w)o(ay)j(to)479 1417 y(add)g(functionality)e(to)i(the)h -(document)d(tree)1746 1384 y Ff(2)1770 1417 y Fv(.)j(The)e(class)j -(type)d Fq(extension)h Fv(is)h(de\002ned)e(in)h Fq(Pxp_document)p -Fv(,)f(too.)p Black 396 1525 a Ft(\225)p Black 60 w Fr(The)i(DTD:)f -Fv(Sometimes)g(it)h(is)g(necessary)e(to)i(access)f(the)h(DTD)f(of)g(a)h -(document;)d(the)i(a)n(v)o(erage)f(application)g(does)479 -1633 y(not)h(need)g(this)g(feature.)f(The)h(class)h Fq(dtd)g -Fv(describes)e(DTDs,)i(and)e(mak)o(es)h(it)h(possible)f(to)h(get)f -(representations)e(of)479 1741 y(element,)i(entity)-5 -b(,)19 b(and)h(notation)e(declarations)h(as)i(well)g(as)g(processing)e -(instructions)g(contained)f(in)j(the)f(DTD.)479 1849 -y(This)g(class,)g(and)f Fq(dtd_element)p Fv(,)g Fq(dtd_notation)p -Fv(,)e(and)i Fq(proc_instruction)f Fv(can)h(be)h(found)e(in)i(the)f -(module)479 1957 y Fq(Pxp_dtd)p Fv(.)h(There)f(are)h(a)h(couple)e(of)h -(classes)h(representing)d(dif)n(ferent)h(kinds)g(of)h(entities;)h -(these)f(can)g(be)g(found)f(in)479 2065 y(the)h(module)f -Fq(Pxp_entity)p Fv(.)396 2214 y(Additionally)-5 b(,)18 -b(the)i(follo)n(wing)f(modules)g(play)h(a)g(role:)p Black -396 2447 a Ft(\225)p Black 60 w Fr(Pxp_yacc:)e Fv(Here)i(the)h(main)e -(parsing)h(functions)e(such)i(as)h Fq(parse_document_entity)c -Fv(are)k(located.)e(Some)479 2555 y(additional)g(types)h(and)g -(functions)f(allo)n(w)h(the)g(parser)f(to)i(be)f(con\002gured)e(in)i(a) -h(non-standard)c(w)o(ay)-5 b(.)p Black 396 2663 a Ft(\225)p -Black 60 w Fr(Pxp_types:)19 b Fv(This)h(is)h(a)g(collection)e(of)h -(basic)g(types)g(and)g(e)o(xceptions.)396 2812 y(There)g(are)g(some)g -(further)e(modules)i(that)g(are)g(needed)f(internally)g(b)n(ut)h(are)g -(not)g(part)g(of)g(the)g(API.)396 2962 y(Let)h(the)f(document)e(to)i -(be)h(parsed)e(be)h(stored)g(in)g(a)h(\002le)g(called)f -Fq(doc.xml)p Fv(.)f(The)h(parsing)f(process)h(is)h(started)f(by)396 -3070 y(calling)g(the)g(function)396 3250 y Fq(val)45 -b(parse_document_entity)c(:)k(config)e(->)i(source)f(->)g('ext)g(spec)h -(->)f('ext)g(document)396 3441 y Fv(de\002ned)19 b(in)i(the)f(module)f -Fq(Pxp_yacc)p Fv(.)g(The)h(\002rst)h(ar)o(gument)d(speci\002es)i(some)g -(global)g(properties)e(of)i(the)g(parser;)g(it)h(is)396 -3549 y(recommended)c(to)j(start)g(with)g(the)g Fq(default_config)p -Fv(.)e(The)h(second)g(ar)o(gument)e(determines)i(where)g(the)h -(document)396 3657 y(to)h(be)f(parsed)f(comes)h(from;)f(this)i(may)f -(be)g(a)g(\002le,)h(a)g(channel,)d(or)i(an)g(entity)g(ID.)g(T)-7 -b(o)21 b(parse)f Fq(doc.xml)p Fv(,)f(it)i(is)g(suf)n(\002cient)396 -3764 y(to)g(pass)f Fq(from_file)44 b("doc.xml")p Fv(.)396 -3914 y(The)20 b(third)g(ar)o(gument)e(passes)i(the)h(object)e -(speci\002cation)h(to)g(use.)g(Roughly)f(speaking,)g(it)i(determines)e -(which)g(classes)396 4022 y(implement)g(the)h(node)g(objects)f(of)h -(which)g(element)g(types,)f(and)h(which)g(e)o(xtensions)f(are)h(to)g -(be)g(used.)g(The)g Fq('ext)396 4130 y Fv(polymorphic)d(v)n(ariable)i -(is)j(the)e(type)f(of)h(the)h(e)o(xtension.)d(F)o(or)i(the)g(moment,)f -(let)i(us)f(simply)g(pass)h Fq(default_spec)d Fv(as)396 -4238 y(this)j(ar)o(gument,)d(and)h(ignore)g(it.)396 4387 -y(So)i(the)f(follo)n(wing)e(e)o(xpression)h(parses)h -Fq(doc.xml)p Fv(:)396 4567 y Fq(open)44 b(Pxp_yacc)396 -4664 y(let)h(d)f(=)h(parse_document_entity)c(default_config)i -(\(from_file)g("doc.xml"\))g(de-)396 4762 y(fault_spec)p -Black 3800 5278 a Fr(25)p Black eop -%%Page: 26 26 -26 25 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(Note)g(that)h Fq(default_config)d -Fv(implies)i(that)h(w)o(arnings)e(are)h(collected)g(b)n(ut)g(not)g -(printed.)e(Errors)h(raise)i(one)f(of)g(the)396 687 y(e)o(xception)f -(de\002ned)g(in)h Fq(Pxp_types)p Fv(;)f(to)i(get)f(readable)f(errors)g -(and)h(w)o(arnings)f(catch)h(the)g(e)o(xceptions)f(as)i(follo)n(ws:)396 -867 y Fq(class)44 b(warner)g(=)486 964 y(object)576 1061 -y(method)f(warn)i(w)f(=)665 1158 y(print_endline)f(\("WARNING:)g(")i(^) -f(w\))486 1256 y(end)396 1353 y(;;)396 1547 y(try)486 -1644 y(let)g(config)g(=)h({)f(default_config)f(with)h(warner)g(=)h(new) -f(warner)g(})g(in)486 1741 y(let)g(d)h(=)g(parse_document_entity)c -(config)j(\(from_file)f("doc.xml"\))g(default_spec)486 -1838 y(in)576 1935 y(...)396 2033 y(with)531 2130 y(e)h(->)620 -2227 y(print_endline)f(\(Pxp_types.string_of_exn)e(e\))396 -2418 y Fv(No)n(w)20 b Fq(d)h Fv(is)g(an)f(object)g(of)g(the)g -Fq(document)f Fv(class.)i(If)f(you)g(w)o(ant)g(the)g(node)f(tree,)h -(you)g(can)g(get)g(the)g(root)f(element)h(by)396 2598 -y Fq(let)45 b(root)f(=)g(d)h(#)g(root)396 2789 y Fv(and)20 -b(if)g(you)g(w)o(ould)f(rather)h(lik)o(e)g(to)g(access)h(the)f(DTD,)g -(determine)f(it)i(by)396 2969 y Fq(let)45 b(dtd)f(=)h(d)f(#)h(dtd)396 -3160 y Fv(As)21 b(it)g(is)g(more)f(interesting,)f(let)h(us)h(in)m(v)o -(estigate)e(the)h(node)f(tree)h(no)n(w)-5 b(.)19 b(Gi)n(v)o(en)g(the)i -(root)e(element,)g(it)i(is)h(possible)d(to)396 3268 y(recursi)n(v)o -(ely)f(tra)n(v)o(erse)h(the)h(whole)f(tree.)g(The)g(children)g(of)g(a)h -(node)f Fq(n)h Fv(are)f(returned)f(by)h(the)h(method)e -Fq(sub_nodes)p Fv(,)g(and)396 3376 y(the)i(type)g(of)g(a)h(node)e(is)i -(returned)d(by)i Fq(node_type)p Fv(.)f(This)i(function)d(tra)n(v)o -(erses)i(the)g(tree,)g(and)g(prints)g(the)g(type)f(of)h(each)396 -3484 y(node:)396 3664 y Fq(let)45 b(rec)f(print_structure)e(n)j(=)486 -3761 y(let)f(ntype)g(=)h(n)g(#)f(node_type)g(in)486 3858 -y(match)g(ntype)g(with)576 3955 y(T_element)f(name)h(->)665 -4053 y(print_endline)f(\("Element)g(of)i(type)f(")h(^)f(name\);)665 -4150 y(let)h(children)e(=)i(n)f(#)h(sub_nodes)e(in)665 -4247 y(List.iter)h(print_structure)e(children)486 4344 -y(|)j(T_data)e(->)665 4441 y(print_endline)g("Data")486 -4538 y(|)i(_)f(->)665 4635 y(\(*)h(Other)f(node)g(types)g(are)g(not)h -(possible)e(unless)h(the)g(parser)g(is)h(configured)800 -4733 y(differently.)710 4830 y(*\))p Black 3798 5278 -a Fr(26)p Black eop -%%Page: 27 27 -27 26 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 665 579 a Fq(assert)44 b(false)396 770 y Fv(Y)-9 -b(ou)20 b(can)g(call)g(this)h(function)e(by)396 950 y -Fq(print_structure)43 b(root)396 1141 y Fv(The)20 b(type)g(returned)e -(by)i Fq(node_type)f Fv(is)i(either)f Fq(T_element)43 -b(name)21 b Fv(or)e Fq(T_data)p Fv(.)h(The)g Fq(name)g -Fv(of)g(the)g(element)g(type)396 1249 y(is)h(the)g(string)e(included)g -(in)i(the)f(angle)f(brack)o(ets.)h(Note)g(that)g(only)f(elements)h(ha)n -(v)o(e)g(children;)f(data)h(nodes)f(are)h(al)o(w)o(ays)396 -1357 y(lea)n(v)o(es)h(of)e(the)i(tree.)396 1506 y(There)f(are)g(some)g -(more)f(methods)g(in)i(order)e(to)h(access)h(a)f(parsed)g(node)f(tree:) -p Black 396 1739 a Ft(\225)p Black 60 w Fq(n)45 b(#)g(parent)p -Fv(:)19 b(Returns)h(the)h(parent)e(node,)g(or)h(raises)h -Fq(Not_found)e Fv(if)h(the)g(node)g(is)h(already)e(the)h(root)p -Black 396 1847 a Ft(\225)p Black 60 w Fq(n)45 b(#)g(root)p -Fv(:)20 b(Returns)g(the)g(root)g(of)f(the)i(node)e(tree.)p -Black 396 1955 a Ft(\225)p Black 60 w Fq(n)45 b(#)g(attribute)e(a)p -Fv(:)21 b(Returns)f(the)g(v)n(alue)f(of)h(the)g(attrib)n(ute)g(with)h -(name)e Fq(a)p Fv(.)i(The)e(method)g(returns)h(a)g(v)n(alue)g(for)479 -2063 y(e)n(v)o(ery)f Fr(declar)m(ed)j Fv(attrib)n(ute,)d(independently) -e(of)j(whether)f(the)i(attrib)n(ute)e(instance)h(is)h(de\002ned)e(or)h -(not.)g(If)g(the)479 2170 y(attrib)n(ute)g(is)h(not)f(declared,)f -Fq(Not_found)g Fv(will)i(be)f(raised.)g(\(In)f(well-formedness)f(mode,) -h(e)n(v)o(ery)g(attrib)n(ute)h(is)479 2278 y(considered)f(as)i(being)e -(implicitly)h(declared)e(with)j(type)f Fq(CDATA)p Fv(.\))479 -2428 y(The)g(follo)n(wing)f(return)g(v)n(alues)g(are)i(possible:)f -Fq(Value)44 b(s)p Fv(,)20 b Fq(Valuelist)43 b(sl)21 b -Fv(,)f(and)g Fq(Implied_value)p Fv(.)e(The)i(\002rst)479 -2536 y(tw)o(o)h(v)n(alue)e(types)h(indicate)g(that)g(the)g(attrib)n -(ute)g(v)n(alue)g(is)h(a)n(v)n(ailable,)e(either)h(because)g(there)f -(is)i(a)g(de\002nition)479 2644 y Fn(a)p Fq(=")p Fn(value)p -Fq(")f Fv(in)g(the)g(XML)g(te)o(xt,)g(or)g(because)g(there)f(is)i(a)g -(def)o(ault)e(v)n(alue)h(\(declared)f(in)h(the)g(DTD\).)g(Only)g(if)g -(both)479 2752 y(the)g(instance)g(de\002nition)f(and)h(the)g(def)o -(ault)g(declaration)e(are)i(missing,)g(the)h(latter)f(v)n(alue)f -Fq(Implied_value)g Fv(will)479 2860 y(be)h(returned.)479 -3009 y(In)g(the)g(DTD,)h(e)n(v)o(ery)d(attrib)n(ute)i(is)h(typed.)e -(There)h(are)g(single-v)n(alue)e(types)i(\(CD)m(A)-9 -b(T)h(A,)20 b(ID,)g(IDREF)-7 b(,)21 b(ENTITY)-11 b(,)479 -3117 y(NMT)o(OKEN,)19 b(enumerations\),)f(in)i(which)g(case)g(the)h -(method)d(passes)j Fq(Value)44 b(s)21 b Fv(back,)e(where)h -Fq(s)g Fv(is)h(the)479 3225 y(normalized)e(string)g(v)n(alue)h(of)g -(the)g(attrib)n(ute.)g(The)f(other)h(types)g(\(IDREFS,)g(ENTITIES,)f -(NMT)o(OKENS\))479 3333 y(represent)g(list)j(v)n(alues,)d(and)h(the)g -(parser)g(splits)h(the)f(XML)g(literal)h(into)e(se)n(v)o(eral)h(tok)o -(ens)g(and)f(returns)h(these)g(tok)o(ens)479 3441 y(as)h -Fq(Valuelist)44 b(sl)p Fv(.)479 3590 y(Normalization)19 -b(means)h(that)g(entity)g(references)e(\(the)i Fq(&)p -Fn(name)p Fq(;)g Fv(tok)o(ens\))f(and)h(character)f(references)479 -3698 y(\()p Fq(&#)p Fn(number)s Fq(;)p Fv(\))g(are)h(replaced)f(by)g -(the)i(te)o(xt)f(the)o(y)f(represent,)g(and)h(that)g(white)g(space)g -(characters)f(are)i(con)m(v)o(erted)479 3806 y(into)f(plain)g(spaces.)p -Black 396 3955 a Ft(\225)p Black 60 w Fq(n)45 b(#)g(data)p -Fv(:)20 b(Returns)g(the)g(character)f(data)h(contained)f(in)h(the)g -(node.)f(F)o(or)h(data)g(nodes,)f(the)h(meaning)f(is)i(ob)o(vious)479 -4063 y(as)g(this)g(is)g(the)f(main)g(content)f(of)h(data)g(nodes.)f(F)o -(or)h(element)g(nodes,)f(this)i(method)e(returns)g(the)h(concatenated) -479 4171 y(contents)g(of)g(all)g(inner)g(data)g(nodes.)479 -4321 y(Note)g(that)h(entity)f(references)e(included)h(in)h(the)h(te)o -(xt)f(are)g(resolv)o(ed)f(while)h(the)o(y)f(are)h(being)g(parsed;)f -(for)h(e)o(xample)479 4429 y(the)g(te)o(xt)h("a)f(<>)g(b")g(will) -h(be)f(returned)e(as)j("a)g(<>)f(b")g(by)g(this)h(method.)d(Spaces)j -(of)f(data)g(nodes)f(are)h(al)o(w)o(ays)479 4537 y(preserv)o(ed.)e(Ne)n -(wlines)j(are)f(preserv)o(ed,)e(b)n(ut)i(al)o(w)o(ays)g(con)m(v)o -(erted)e(to)i(\\n)h(characters)e(e)n(v)o(en)g(if)i(ne)n(wlines)e(are)i -(encoded)479 4644 y(as)g(\\r\\n)f(or)g(\\r)-5 b(.)21 -b(Normally)e(you)g(will)i(ne)n(v)o(er)e(see)i(tw)o(o)f(adjacent)f(data) -i(nodes)e(because)h(the)g(parser)f(collapses)h(all)h(data)479 -4752 y(material)f(at)h(one)e(location)h(into)g(one)f(node.)g(\(Ho)n(we) -n(v)o(er)m(,)f(if)i(you)g(create)g(your)f(o)n(wn)g(tree)h(or)g -(transform)f(the)h(parsed)479 4860 y(tree,)g(it)h(is)g(possible)f(to)h -(ha)n(v)o(e)e(adjacent)h(data)g(nodes.\))p Black 3797 -5278 a Fr(27)p Black eop -%%Page: 28 28 -28 27 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 479 579 a Fv(Note)g(that)h(elements)f(that)g(do)g -Fr(not)h Fv(allo)n(w)f(#PCD)m(A)-9 b(T)h(A)20 b(as)h(content)e(will)i -(not)f(ha)n(v)o(e)g(data)g(nodes)f(as)i(children.)e(This)479 -687 y(means)h(that)g(spaces)h(and)f(ne)n(wlines,)f(the)h(only)g -(character)f(material)g(allo)n(wed)h(for)g(such)f(elements,)h(are)g -(silently)479 795 y(dropped.)396 986 y(F)o(or)g(e)o(xample,)e(if)i(the) -f(task)h(is)h(to)f(print)f(all)h(contents)f(of)g(elements)h(with)f -(type)h("v)n(aluable")e(whose)h(attrib)n(ute)g("priority")396 -1094 y(is)i("1",)f(this)h(function)d(can)i(help:)396 -1274 y Fq(let)45 b(rec)f(print_valuable_prio1)d(n)k(=)486 -1371 y(let)f(ntype)g(=)h(n)g(#)f(node_type)g(in)486 1468 -y(match)g(ntype)g(with)576 1565 y(T_element)f("valuable")g(when)h(n)h -(#)g(attribute)e("priority")g(=)i(Value)f("1")g(->)665 -1662 y(print_endline)f("Valuable)g(node)h(with)h(priotity)e(1)i -(found:";)665 1759 y(print_endline)e(\(n)h(#)h(data\))486 -1857 y(|)g(\(T_element)e(_)h(|)h(T_data\))f(->)665 1954 -y(let)h(children)e(=)i(n)f(#)h(sub_nodes)e(in)665 2051 -y(List.iter)h(print_valuable_prio1)d(children)486 2148 -y(|)k(_)f(->)665 2245 y(assert)g(false)396 2436 y Fv(Y)-9 -b(ou)20 b(can)g(call)g(this)h(function)e(by:)396 2616 -y Fq(print_valuable_prio1)42 b(root)396 2807 y Fv(If)20 -b(you)g(lik)o(e)g(a)h(DSSSL-lik)o(e)f(style,)g(you)g(can)g(mak)o(e)f -(the)h(function)f Fq(process_children)f Fv(e)o(xplicit:)396 -2987 y Fq(let)45 b(rec)f(print_valuable_prio1)d(n)k(=)486 -3182 y(let)f(process_children)e(n)j(=)576 3279 y(let)f(children)f(=)i -(n)g(#)f(sub_nodes)g(in)576 3376 y(List.iter)f(print_valuable_prio1)e -(children)486 3473 y(in)486 3667 y(let)j(ntype)g(=)h(n)g(#)f(node_type) -g(in)486 3764 y(match)g(ntype)g(with)576 3862 y(T_element)f("valuable") -g(when)h(n)h(#)g(attribute)e("priority")g(=)i(Value)f("1")g(->)665 -3959 y(print_endline)f("Valuable)g(node)h(with)h(priority)e(1)i -(found:";)665 4056 y(print_endline)e(\(n)h(#)h(data\))486 -4153 y(|)g(\(T_element)e(_)h(|)h(T_data\))f(->)665 4250 -y(process_children)e(n)486 4347 y(|)j(_)f(->)665 4444 -y(assert)g(false)396 4635 y Fv(So)21 b(f)o(ar)m(,)e(O'Caml)h(is)i(no)n -(w)d(a)i(simple)f("style-sheet)g(language":)e(Y)-9 b(ou)20 -b(can)g(form)f(a)h(big)g("match")g(e)o(xpression)e(to)396 -4743 y(distinguish)h(between)h(all)h(signi\002cant)e(cases,)i(and)f -(pro)o(vide)e(dif)n(ferent)g(reactions)i(on)g(dif)n(ferent)e -(conditions.)h(But)h(this)396 4851 y(technique)f(has)h(limitations;)g -(the)h("match")e(e)o(xpression)g(tends)h(to)g(get)g(lar)o(ger)f(and)h -(lar)o(ger)m(,)e(and)i(it)g(is)i(dif)n(\002cult)d(to)i(store)p -Black 3800 5278 a Fr(28)p Black eop -%%Page: 29 29 -29 28 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(intermediate)f(v)n(alues)h(as)h(there)e(is)j(only)d -(one)h(big)f(recursion.)g(Alternati)n(v)o(ely)-5 b(,)18 -b(it)j(is)g(also)f(possible)g(to)h(represent)e(the)396 -687 y(v)n(arious)g(cases)i(as)g(classes,)g(and)f(to)g(use)h(dynamic)d -(method)h(lookup)g(to)h(\002nd)g(the)g(appropiate)e(class.)j(The)f(ne)o -(xt)f(section)396 795 y(e)o(xplains)g(this)i(technique)e(in)h(detail.) --2 1213 y Fx(2.3.)39 b(Class-based)e(pr)m(ocessing)g(of)j(the)f(node)f -(tree)396 1393 y Fv(By)21 b(def)o(ault,)e(the)h(parsed)g(node)f(tree)h -(consists)h(of)f(objects)g(of)g(the)g(same)g(class;)h(this)g(is)g(a)g -(good)e(design)g(as)i(long)e(as)i(you)396 1501 y(w)o(ant)g(only)e(to)h -(access)h(selected)f(parts)g(of)g(the)h(document.)c(F)o(or)j(comple)o -(x)f(transformations,)e(it)k(may)f(be)g(better)g(to)g(use)396 -1609 y(dif)n(ferent)f(classes)i(for)f(objects)g(describing)e(dif)n -(ferent)h(element)g(types.)396 1758 y(F)o(or)h(e)o(xample,)f(if)h(the)g -(DTD)h(declares)e(the)i(element)e(types)h Fq(a)p Fv(,)h -Fq(b)p Fv(,)f(and)g Fq(c)p Fv(,)g(and)g(if)g(the)g(task)h(is)g(to)f -(con)m(v)o(ert)e(an)j(arbitrary)396 1866 y(document)d(into)i(a)h -(printable)e(format,)g(the)h(idea)g(is)h(to)f(de\002ne)g(for)g(e)n(v)o -(ery)f(element)g(type)h(a)g(separate)g(class)h(that)g(has)f(a)396 -1974 y(method)f Fq(print)p Fv(.)h(The)g(classes)h(are)f -Fq(eltype_a)p Fv(,)f Fq(eltype_b)p Fv(,)g(and)h Fq(eltype_c)p -Fv(,)f(and)h(e)n(v)o(ery)f(class)i(implements)396 2082 -y Fq(print)f Fv(such)g(that)g(elements)g(of)g(the)g(type)g -(corresponding)d(to)j(the)g(class)i(are)e(con)m(v)o(erted)d(to)k(the)f -(output)f(format.)396 2232 y(The)h(parser)g(supports)f(such)h(a)g -(design)g(directly)-5 b(.)19 b(As)i(it)g(is)g(impossible)e(to)i(deri)n -(v)o(e)d(recursi)n(v)o(e)h(classes)i(in)g(O'Caml)3703 -2198 y Ff(3)3727 2232 y Fv(,)g(the)396 2340 y(specialized)f(element)f -(classes)j(cannot)d(be)h(formed)f(by)g(simply)h(inheriting)f(from)g -(the)h(b)n(uilt-in)g(classes)h(of)f(the)g(parser)396 -2447 y(and)g(adding)f(methods)g(for)g(customized)g(functionality)-5 -b(.)18 b(T)-7 b(o)20 b(get)g(around)f(this)h(limitation,)g(e)n(v)o(ery) -f(node)g(of)h(the)396 2555 y(document)e(tree)j(is)g(represented)d(by)i -Fr(two)h Fv(objects,)e(one)h(called)g("the)g(node")f(and)h(containing)e -(the)i(recursi)n(v)o(e)396 2663 y(de\002nition)f(of)h(the)g(tree,)g -(one)g(called)g("the)g(e)o(xtension".)e(Ev)o(ery)h(node)g(object)h(has) -g(a)h(reference)e(to)h(the)g(e)o(xtension,)f(and)396 -2771 y(the)h(e)o(xtension)f(has)i(a)f(reference)f(to)h(the)g(node.)f -(The)h(adv)n(antage)e(of)i(this)h(model)e(is)i(that)g(it)g(is)g(no)n(w) -e(possible)h(to)396 2879 y(customize)g(the)g(e)o(xtension)f(without)g -(af)n(fecting)g(the)h(typing)f(constraints)g(of)h(the)h(recursi)n(v)o -(e)d(node)h(de\002nition.)396 3029 y(Ev)o(ery)g(e)o(xtension)g(must)h -(ha)n(v)o(e)g(the)g(three)g(methods)f Fq(clone)p Fv(,)g -Fq(node)p Fv(,)h(and)g Fq(set_node)p Fv(.)f(The)h(method)f -Fq(clone)h Fv(creates)396 3137 y(a)h(deep)e(cop)o(y)h(of)g(the)g(e)o -(xtension)f(object)g(and)h(returns)f(it;)i Fq(node)f -Fv(returns)g(the)g(node)f(object)h(for)f(this)i(e)o(xtension)e(object;) -396 3244 y(and)h Fq(set_node)f Fv(is)i(used)f(to)h(tell)g(the)f(e)o -(xtension)f(object)g(which)h(node)f(is)i(associated)f(with)g(it,)h -(this)g(method)e(is)396 3352 y(automatically)g(called)h(when)g(the)g -(node)f(tree)h(is)h(initialized.)f(The)g(follo)n(wing)e(de\002nition)h -(is)i(a)g(good)e(starting)h(point)396 3460 y(for)g(these)g(methods;)f -(usually)h Fq(clone)g Fv(must)g(be)g(further)f(re\002ned)g(when)h -(instance)g(v)n(ariables)f(are)h(added)f(to)h(the)h(class:)396 -3640 y Fq(class)44 b(custom_extension)e(=)486 3738 y(object)i(\(self\)) -576 3932 y(val)g(mutable)g(node)g(=)g(\(None)g(:)h(custom_extension)d -(node)i(option\))576 4126 y(method)f(clone)h(=)h({<)g(>})576 -4223 y(method)e(node)i(=)665 4320 y(match)f(node)g(with)845 -4418 y(None)g(->)934 4515 y(assert)g(false)755 4612 y(|)h(Some)f(n)g -(->)h(n)576 4709 y(method)e(set_node)h(n)h(=)665 4806 -y(node)f(<-)h(Some)f(n)p Black 3800 5278 a Fr(29)p Black -eop -%%Page: 30 30 -30 29 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 486 676 a Fq(end)396 867 y Fv(This)h(part)e(of)h(the)h(e)o -(xtension)d(is)j(usually)f(the)g(same)h(for)e(all)i(classes,)g(so)g(it) -g(is)g(a)f(good)f(idea)h(to)g(consider)396 975 y Fq(custom_extension)e -Fv(as)j(the)f(super)n(-class)g(of)g(the)h(further)d(class)j -(de\002nitions.)e(Continuining)f(the)j(e)o(xample)d(of)396 -1083 y(abo)o(v)o(e,)h(we)h(can)g(de\002ne)g(the)g(element)g(type)f -(classes)j(as)e(follo)n(ws:)396 1263 y Fq(class)44 b(virtual)g -(custom_extension)e(=)486 1360 y(object)i(\(self\))576 -1457 y(...)g(clone,)g(node,)g(set_node)f(defined)h(as)g(above)g(...)576 -1652 y(method)f(virtual)h(print)g(:)h(out_channel)e(->)h(unit)486 -1749 y(end)396 1943 y(class)g(eltype_a)g(=)486 2040 y(object)g -(\(self\))576 2137 y(inherit)f(custom_extension)576 2234 -y(method)g(print)h(ch)h(=)g(...)486 2332 y(end)396 2526 -y(class)f(eltype_b)g(=)486 2623 y(object)g(\(self\))576 -2720 y(inherit)f(custom_extension)576 2817 y(method)g(print)h(ch)h(=)g -(...)486 2914 y(end)396 3109 y(class)f(eltype_c)g(=)486 -3206 y(object)g(\(self\))576 3303 y(inherit)f(custom_extension)576 -3400 y(method)g(print)h(ch)h(=)g(...)486 3497 y(end)396 -3688 y Fv(The)20 b(method)f Fq(print)h Fv(can)g(no)n(w)f(be)i -(implemented)d(for)h(e)n(v)o(ery)g(element)h(type)g(separately)-5 -b(.)18 b(Note)i(that)h(you)e(get)h(the)396 3796 y(associated)g(node)f -(by)h(in)m(v)n(oking)396 3976 y Fq(self)44 b(#)h(node)396 -4167 y Fv(and)20 b(you)f(get)h(the)h(e)o(xtension)d(object)i(of)g(a)h -(node)e Fq(n)h Fv(by)g(writing)396 4347 y Fq(n)45 b(#)g(extension)396 -4538 y Fv(It)21 b(is)g(guaranteed)d(that)396 4718 y Fq(self)44 -b(#)h(node)f(#)h(extension)e(==)i(self)p Black 3800 5278 -a Fr(30)p Black eop -%%Page: 31 31 -31 30 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(al)o(w)o(ays)h(holds.)396 728 y(Here)f(are)g(sample) -g(de\002nitions)g(of)g(the)g Fq(print)g Fv(methods:)396 -909 y Fq(class)44 b(eltype_a)g(=)486 1006 y(object)g(\(self\))576 -1103 y(inherit)f(custom_extension)576 1200 y(method)g(print)h(ch)h(=) -665 1297 y(\(*)g(Nodes)f(...)f(are)h(only)g(containers:)f(*\)) -665 1394 y(output_string)g(ch)h("\(";)665 1491 y(List.iter)755 -1588 y(\(fun)g(n)h(->)f(n)h(#)g(extension)e(#)i(print)f(ch\))755 -1686 y(\(self)g(#)h(node)f(#)g(sub_nodes\);)665 1783 -y(output_string)f(ch)h("\)";)486 1880 y(end)396 2074 -y(class)g(eltype_b)g(=)486 2171 y(object)g(\(self\))576 -2268 y(inherit)f(custom_extension)576 2366 y(method)g(print)h(ch)h(=) -665 2463 y(\(*)g(Print)f(the)g(value)g(of)h(the)f(CDATA)g(attribute)f -("print":)h(*\))665 2560 y(match)g(self)g(#)h(node)f(#)h(attribute)e -("print")h(with)755 2657 y(Value)g(s)314 b(->)44 b(output_string)f(ch)h -(s)665 2754 y(|)h(Implied_value)e(->)h(output_string)f(ch)h -("")665 2851 y(|)h(Valuelist)e(l)135 b(->)44 -b(assert)g(false)1517 2948 y(\(*)h(not)f(possible)f(because)h(the)g -(att)h(is)f(CDATA)g(*\))486 3045 y(end)396 3240 y(class)g(eltype_c)g(=) -486 3337 y(object)g(\(self\))576 3434 y(inherit)f(custom_extension)576 -3531 y(method)g(print)h(ch)h(=)665 3628 y(\(*)g(Print)f(the)g(contents) -g(of)g(this)g(element:)g(*\))665 3725 y(output_string)f(ch)h(\(self)g -(#)h(node)f(#)h(data\))486 3823 y(end)396 4017 y(class)f -(null_extension)f(=)486 4114 y(object)h(\(self\))576 -4211 y(inherit)f(custom_extension)576 4308 y(method)g(print)h(ch)h(=)g -(assert)e(false)486 4405 y(end)396 4638 y Fv(The)20 b(remaining)f(task) -h(is)h(to)g(con\002gure)d(the)i(parser)g(such)g(that)g(these)g(e)o -(xtension)f(classes)i(are)f(actually)g(used.)g(Here)396 -4746 y(another)f(problem)f(arises:)j(It)g(is)g(not)f(possible)g(to)g -(dynamically)e(select)j(the)f(class)h(of)f(an)g(object)g(to)g(be)h -(created.)e(As)396 4854 y(w)o(orkaround,)e(PXP)k(allo)n(ws)g(the)f -(user)g(to)g(specify)g Fr(e)n(xemplar)g(objects)g Fv(for)f(the)h(v)n -(arious)g(element)f(types;)h(instead)g(of)p Black 3800 -5278 a Fr(31)p Black eop -%%Page: 32 32 -32 31 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(creating)f(the)i(nodes)e(of)h(the)g(tree)g(by)g -(applying)f(the)h Fq(new)g Fv(operator)e(the)j(nodes)e(are)h(produced)e -(by)i(duplicating)e(the)396 687 y(e)o(x)o(emplars.)h(As)h(object)g -(duplication)f(preserv)o(es)g(the)h(class)h(of)f(the)g(object,)f(one)h -(can)g(create)g(fresh)g(objects)g(of)g(e)n(v)o(ery)396 -795 y(class)h(for)f(which)g(pre)n(viously)e(an)i(e)o(x)o(emplar)e(has)j -(been)e(re)o(gistered.)396 944 y(Ex)o(emplars)g(are)h(meant)g(as)h -(objects)f(without)f(contents,)g(the)h(only)g(interesting)f(thing)g(is) -j(that)e(e)o(x)o(emplars)e(are)396 1052 y(instances)i(of)g(a)h(certain) -f(class.)g(The)g(creation)f(of)h(an)h(e)o(x)o(emplar)d(for)h(an)h -(element)g(node)f(can)h(be)g(done)f(by:)396 1232 y Fq(let)45 -b(element_exemplar)d(=)i(new)h(element_impl)e(extension_exemplar)396 -1423 y Fv(And)20 b(a)h(data)f(node)f(e)o(x)o(emplar)f(is)j(created)f -(by:)396 1603 y Fq(let)45 b(data_exemplar)d(=)j(new)f(data_impl)g -(extension_exemplar)396 1794 y Fv(The)20 b(classes)h -Fq(element_impl)e Fv(and)h Fq(data_impl)f Fv(are)h(de\002ned)f(in)i -(the)f(module)f Fq(Pxp_document)p Fv(.)f(The)396 1902 -y(constructors)h(initialize)h(the)g(fresh)g(objects)g(as)h(empty)e -(objects,)h(i.e.)g(without)g(children,)e(without)i(data)g(contents,)f -(and)396 2010 y(so)i(on.)e(The)h Fq(extension_exemplar)e -Fv(is)j(the)f(initial)h(e)o(xtension)e(object)g(the)h(e)o(x)o(emplars)f -(are)h(associated)g(with.)396 2160 y(Once)g(the)g(e)o(x)o(emplars)f -(are)h(created)f(and)h(stored)g(some)n(where)f(\(e.g.)g(in)h(a)h(hash)f -(table\),)f(you)h(can)g(tak)o(e)g(an)g(e)o(x)o(emplar)396 -2268 y(and)g(create)g(a)g(concrete)f(instance)h(\(with)g(contents\))f -(by)h(duplicating)e(it.)j(As)g(user)f(of)g(the)g(parser)g(you)f(are)h -(normally)396 2376 y(not)g(concerned)e(with)i(this)h(as)g(this)g(is)g -(part)f(of)g(the)g(internal)f(logic)h(of)g(the)g(parser)m(,)f(b)n(ut)h -(as)h(background)c(kno)n(wledge)h(it)396 2483 y(is)j(w)o(orthwhile)e -(to)i(mention)e(that)h(the)g(tw)o(o)h(methods)e Fq(create_element)f -Fv(and)i Fq(create_data)f Fv(actually)g(perform)396 2591 -y(the)h(duplication)f(of)g(the)i(e)o(x)o(emplar)d(for)h(which)h(the)o -(y)f(are)h(in)m(v)n(ok)o(ed,)e(additionally)g(apply)i(modi\002cations)e -(to)j(the)f(clone,)396 2699 y(and)g(\002nally)g(return)f(the)h(ne)n(w)g -(object.)f(Moreo)o(v)o(er)m(,)f(the)i(e)o(xtension)e(object)i(is)h -(copied,)e(too,)h(and)f(the)i(ne)n(w)f(node)f(object)396 -2807 y(is)i(associated)f(with)g(the)g(fresh)g(e)o(xtension)e(object.)i -(Note)g(that)g(this)g(is)h(the)f(reason)g(why)f(e)n(v)o(ery)g(e)o -(xtension)f(object)i(must)396 2915 y(ha)n(v)o(e)g(a)g -Fq(clone)g Fv(method.)396 3065 y(The)g(con\002guration)e(of)i(the)g -(set)h(of)f(e)o(x)o(emplars)e(is)j(passed)f(to)h(the)f -Fq(parse_document_entity)d Fv(function)i(as)i(third)396 -3173 y(ar)o(gument.)d(In)i(our)f(e)o(xample,)g(this)h(ar)o(gument)e -(can)i(be)g(set)h(up)f(as)h(follo)n(ws:)396 3353 y Fq(let)45 -b(spec)f(=)486 3450 y(make_spec_from_alist)576 3547 y(~data_exemplar:) -535 b(\(new)44 b(data_impl)g(\(new)g(null_extension\)\))576 -3644 y(~default_element_exemplar:)c(\(new)k(element_impl)f(\(new)h -(null_extension\)\))576 3741 y(~element_alist:)710 3838 -y([)h("a",)89 b(new)44 b(element_impl)f(\(new)h(eltype_a\);)800 -3935 y("b",)89 b(new)44 b(element_impl)f(\(new)h(eltype_b\);)800 -4033 y("c",)89 b(new)44 b(element_impl)f(\(new)h(eltype_c\);)710 -4130 y(])576 4227 y(\(\))396 4418 y Fv(The)20 b Fq(~element_alist)f -Fv(function)f(ar)o(gument)g(de\002nes)i(the)g(mapping)e(from)h(element) -h(types)g(to)g(e)o(x)o(emplars)f(as)396 4526 y(associati)n(v)o(e)h -(list.)h(The)f(ar)o(gument)e Fq(~data_exemplar)g Fv(speci\002es)j(the)f -(e)o(x)o(emplar)e(for)i(data)g(nodes,)f(and)h(the)396 -4634 y Fq(~default_element_exemplar)d Fv(is)k(used)f(whene)n(v)o(er)e -(the)i(parser)g(\002nds)g(an)g(element)g(type)f(for)h(which)g(the)396 -4742 y(associati)n(v)o(e)g(list)h(does)f(not)g(de\002ne)g(an)g(e)o(x)o -(emplar)-5 b(.)p Black 3800 5278 a Fr(32)p Black eop -%%Page: 33 33 -33 32 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(The)g(con\002guration)e(is)j(no)n(w)e(complete.)g(Y) --9 b(ou)20 b(can)g(still)h(use)g(the)f(same)g(parsing)f(functions,)g -(only)g(the)h(initialization)g(is)396 687 y(a)h(bit)f(dif)n(ferent.)f -(F)o(or)g(e)o(xample,)g(call)i(the)f(parser)f(by:)396 -867 y Fq(let)45 b(d)f(=)h(parse_document_entity)c(default_config)i -(\(from_file)g("doc.xml"\))g(spec)396 1058 y Fv(Note)20 -b(that)h(the)f(resulting)f(document)f Fq(d)j Fv(has)f(a)h(usable)f -(type;)g(especially)f(the)i Fq(print)f Fv(method)e(we)j(added)e(is)i -(visible.)396 1166 y(So)g(you)e(can)h(print)g(your)e(document)h(by)396 -1346 y Fq(d)45 b(#)g(root)f(#)g(extension)g(#)g(print)g(stdout)396 -1578 y Fv(This)21 b(object-oriented)c(approach)h(looks)i(rather)f -(complicated;)g(this)h(is)i(mostly)d(caused)h(by)g(w)o(orking)e(around) -h(some)396 1686 y(problems)g(of)h(the)g(strict)h(typing)e(system)h(of)g -(O'Caml.)g(Some)g(auxiliary)f(concepts)g(such)h(as)h(e)o(xtensions)e -(were)396 1794 y(needed,)g(b)n(ut)h(the)g(practical)g(consequences)e -(are)i(lo)n(w)-5 b(.)20 b(In)g(the)g(ne)o(xt)f(section,)h(one)g(of)g -(the)g(e)o(xamples)f(of)h(the)396 1902 y(distrib)n(ution)f(is)i(e)o -(xplained,)d(a)j(con)m(v)o(erter)d(from)h Fr(r)m(eadme)h -Fv(documents)e(to)i(HTML.)-2 2321 y Fx(2.4.)39 b(Example:)f(An)h(HTML)f -(bac)m(kend)g(f)m(or)h(the)g Fd(readme)44 b Fx(DTD)396 -2501 y Fv(The)20 b(con)m(v)o(erter)e(from)h Fr(r)m(eadme)h -Fv(documents)e(to)i(HTML)g(documents)f(follo)n(ws)h(strictly)g(the)g -(approach)e(to)j(de\002ne)e(one)396 2609 y(class)i(per)f(element)g -(type.)f(The)h(HTML)g(code)g(is)h(similar)f(to)g(the)h -Fr(r)m(eadme)e Fv(source,)g(because)h(of)g(this)h(most)f(elements)396 -2716 y(can)g(be)g(con)m(v)o(erted)e(in)i(the)g(follo)n(wing)f(w)o(ay:)h -(Gi)n(v)o(en)g(the)g(input)f(element)396 2897 y Fq(content)396 -3088 y Fv(the)h(con)m(v)o(ersion)e(te)o(xt)i(is)h(the)f(concatenation)e -(of)i(a)h(computed)d(pre\002x,)h(the)h(recursi)n(v)o(ely)f(con)m(v)o -(erted)e(content,)i(and)h(a)396 3195 y(computed)e(suf)n(\002x.)396 -3345 y(Only)i(one)g(element)f(type)h(cannot)f(be)h(handled)f(by)h(this) -g(scheme:)g Fq(footnote)p Fv(.)f(F)o(ootnotes)g(are)h(collected)g -(while)g(the)o(y)396 3453 y(are)g(found)f(in)h(the)g(input)g(te)o(xt,)g -(and)f(the)o(y)h(are)g(printed)f(after)h(the)g(main)g(te)o(xt)g(has)g -(been)g(con)m(v)o(erted)d(and)j(printed.)-2 3781 y Fp(2.4.1.)35 -b(Header)396 4021 y Fq(open)44 b(Pxp_types)396 4118 y(open)g -(Pxp_document)-2 4571 y Fp(2.4.2.)35 b(T)-7 b(ype)34 -b(dec)n(larations)396 4811 y Fq(class)44 b(type)g(footnote_printer)f(=) -p Black 3800 5278 a Fr(33)p Black eop -%%Page: 34 34 -34 33 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 486 579 a Fq(object)576 676 y(method)43 b(footnote_to_html)g(:)h -(store_type)f(-)p Fo(>)i Fq(out_channel)e(-)p Fo(>)h -Fq(unit)486 773 y(end)396 967 y(and)h(store_type)e(=)486 -1065 y(object)576 1162 y(method)g(alloc_footnote)g(:)i -(footnote_printer)d(-)p Fo(>)i Fq(int)576 1259 y(method)f -(print_footnotes)g(:)h(out_channel)f(-)p Fo(>)i Fq(unit)486 -1356 y(end)396 1453 y(;;)-2 1906 y Fp(2.4.3.)35 b(Class)g -Fc(store)396 2073 y Fv(The)20 b Fq(store)g Fv(is)h(a)g(container)d(for) -i(footnotes.)f(Y)-9 b(ou)19 b(can)h(add)g(a)g(footnote)f(by)h(in)m(v)n -(oking)e Fq(alloc_footnote)p Fv(;)g(the)396 2181 y(ar)o(gument)g(is)j -(an)f(object)g(of)g(the)g(class)h Fq(footnote_printer)p -Fv(,)d(the)i(method)f(returns)g(the)i(number)d(of)i(the)g(footnote.)396 -2289 y(The)g(interesting)f(property)f(of)i(a)h(footnote)d(is)k(that)e -(it)h(can)f(be)g(con)m(v)o(erted)d(to)k(HTML,)e(so)i(a)g -Fq(footnote_printer)d Fv(is)396 2397 y(an)i(object)g(with)g(a)h(method) -e Fq(footnote_to_html)p Fv(.)f(The)i(class)h Fq(footnote)e -Fv(which)h(is)h(de\002ned)e(belo)n(w)h(has)g(a)396 2505 -y(compatible)f(method)g Fq(footnote_to_html)f Fv(such)i(that)g(objects) -g(created)f(from)h(it)h(can)f(be)g(used)g(as)396 2613 -y Fq(footnote_printer)p Fv(s.)396 2763 y(The)g(other)f(method,)g -Fq(print_footnotes)f Fv(prints)i(the)g(footnotes)f(as)i(de\002nition)e -(list,)i(and)f(is)h(typically)e(in)m(v)n(ok)o(ed)396 -2870 y(after)h(the)g(main)g(material)g(of)g(the)g(page)g(has)g(already) -f(been)h(printed.)e(Ev)o(ery)h(item)h(of)g(the)h(list)g(is)g(printed)e -(by)396 2978 y Fq(footnote_to_html)p Fv(.)396 3200 y -Fq(class)44 b(store)g(=)486 3297 y(object)g(\(self\))576 -3491 y(val)g(mutable)g(footnotes)f(=)i(\()f([])h(:)f(\(int)h(*)f -(footnote_printer\))e(list)i(\))576 3589 y(val)g(mutable)g -(next_footnote_number)d(=)k(1)576 3783 y(method)e(alloc_footnote)g(n)i -(=)665 3880 y(let)g(number)e(=)i(next_footnote_number)d(in)665 -3977 y(next_footnote_number)g Fo(<)p Fq(-)i(number+1;)665 -4074 y(footnotes)g Fo(<)p Fq(-)g(footnotes)f(@)i([)g(number,)e(n)i(];) -665 4171 y(number)576 4366 y(method)e(print_footnotes)g(ch)h(=)665 -4463 y(if)h(footnotes)e Fo(<>)h Fq([])h(then)f(begin)396 -4560 y(output_string)f(ch)h(")p Fo(<)p Fq(hr)g(align=left)g -(noshade=noshade)e(width=\\"30\045\\")p Fo(>)p Fq(\\n";)396 -4657 y(output_string)h(ch)h(")p Fo(<)p Fq(dl)p Fo(>)p -Fq(\\n";)396 4754 y(List.iter)486 4851 y(\(fun)g(\(_,n\))g(-)p -Fo(>)p Black 3800 5278 a Fr(34)p Black eop -%%Page: 35 35 -35 34 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 620 579 a Fq(n)45 b(#)g(footnote_to_html)d(\(self)i(:)h -(#store_type)e(:)p Fo(>)h Fq(store_type\))f(ch\))486 -676 y(footnotes;)396 773 y(output_string)g(ch)h(")p Fo(<)p -Fq(/dl)p Fo(>)p Fq(\\n";)665 870 y(end)486 1065 y(end)396 -1162 y(;;)-2 1614 y Fp(2.4.4.)35 b(Function)f Fc(escape_html)396 -1782 y Fv(This)21 b(function)d(con)m(v)o(erts)h(the)h(characters)f -Fm(<)p Fv(,)h Fm(>)p Fv(,)g(&,)g(and)g(")h(to)f(their)g(HTML)g -(representation.)e(F)o(or)h(e)o(xample,)396 1890 y Fq(escape_html)43 -b(")p Fo(<>)p Fq(")h(=)h("<>")p Fv(.)19 b(Other)g(characters)h -(are)g(left)g(unchanged.)396 2070 y Fq(let)45 b(escape_html)e(s)h(=)486 -2167 y(Str.global_substitute)576 2264 y(\(Str.regexp)f(")p -Fo(<)p Fq(\\\\|)p Fo(>)p Fq(\\\\|&\\\\|\\""\))576 2362 -y(\(fun)h(s)g(-)p Fo(>)665 2459 y Fq(match)g(Str.matched_string)e(s)j -(with)755 2556 y(")p Fo(<)p Fq(")f(-)p Fo(>)h Fq("<")665 -2653 y(|)g(")p Fo(>)p Fq(")f(-)p Fo(>)h Fq(">")665 -2750 y(|)g("&")f(-)p Fo(>)h Fq("&")665 2847 y(|)g("\\"")f(-)p -Fo(>)g Fq(""")665 2944 y(|)h(_)g(-)p Fo(>)f Fq(assert)g(false\)) -576 3042 y(s)396 3139 y(;;)-2 3591 y Fp(2.4.5.)35 b(Vir)r(tual)f(c)n -(lass)h Fc(shared)396 3759 y Fv(This)21 b(virtual)e(class)i(is)g(the)g -(abstract)f(superclass)g(of)f(the)i(e)o(xtension)d(classes)k(sho)n(wn)d -(belo)n(w)-5 b(.)19 b(It)i(de\002nes)f(the)g(standard)396 -3867 y(methods)f Fq(clone)p Fv(,)h Fq(node)p Fv(,)g(and)g -Fq(set_node)p Fv(,)f(and)g(declares)h(the)g(type)g(of)g(the)g(virtual)g -(method)e Fq(to_html)p Fv(.)i(This)396 3975 y(method)f(recursi)n(v)o -(ely)f(tra)n(v)o(erses)i(the)g(whole)g(element)g(tree,)g(and)f(prints)h -(the)g(con)m(v)o(erted)e(HTML)i(code)f(to)i(the)f(output)396 -4083 y(channel)f(passed)h(as)h(second)f(ar)o(gument.)d(The)j(\002rst)h -(ar)o(gument)d(is)j(the)f(reference)f(to)h(the)g(global)f -Fq(store)h Fv(object)g(which)396 4191 y(collects)h(the)f(footnotes.)396 -4371 y Fq(class)44 b(virtual)g(shared)g(=)486 4468 y(object)g(\(self\)) -576 4662 y(\(*)g(--)h(default_ext)e(--)h(*\))576 4857 -y(val)g(mutable)g(node)g(=)g(\(None)g(:)h(shared)f(node)g(option\))p -Black 3800 5278 a Fr(35)p Black eop -%%Page: 36 36 -36 35 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 576 676 a Fq(method)43 b(clone)h(=)h({)p Fo(<)f(>)p -Fq(})576 773 y(method)f(node)i(=)665 870 y(match)f(node)g(with)845 -967 y(None)g(-)p Fo(>)934 1065 y Fq(assert)g(false)755 -1162 y(|)h(Some)f(n)g(-)p Fo(>)h Fq(n)576 1259 y(method)e(set_node)h(n) -h(=)665 1356 y(node)f Fo(<)p Fq(-)h(Some)f(n)576 1550 -y(\(*)g(--)h(virtual)e(--)i(*\))576 1745 y(method)e(virtual)h(to_html)g -(:)g(store)g(-)p Fo(>)h Fq(out_channel)e(-)p Fo(>)h Fq(unit)486 -1939 y(end)396 2036 y(;;)-2 2489 y Fp(2.4.6.)35 b(Class)g -Fc(only_data)396 2656 y Fv(This)21 b(class)g(de\002nes)f -Fq(to_html)f Fv(such)h(that)h(the)f(character)f(data)h(of)g(the)g -(current)f(node)g(is)i(con)m(v)o(erted)d(to)i(HTML.)g(Note)396 -2764 y(that)h Fq(self)f Fv(is)h(an)f(e)o(xtension)f(object,)g -Fq(self)44 b(#)h(node)20 b Fv(is)h(the)f(node)f(object,)h(and)f -Fq(self)45 b(#)f(node)g(#)h(data)20 b Fv(returns)396 -2872 y(the)g(character)f(data)h(of)g(the)h(node.)396 -3052 y Fq(class)44 b(only_data)g(=)486 3149 y(object)g(\(self\))576 -3247 y(inherit)f(shared)576 3441 y(method)g(to_html)h(store)g(ch)h(=) -665 3538 y(output_string)e(ch)h(\(escape_html)f(\(self)h(#)h(node)f(#)h -(data\)\))486 3635 y(end)396 3732 y(;;)-2 4185 y Fp(2.4.7.)35 -b(Class)g Fc(readme)396 4353 y Fv(This)21 b(class)g(con)m(v)o(erts)d -(elements)i(of)g(type)g Fq(readme)g Fv(to)g(HTML.)g(Such)f(an)h -(element)g(is)h(\(by)f(de\002nition\))e(al)o(w)o(ays)j(the)396 -4461 y(root)f(element)f(of)h(the)g(document.)e(First,)j(the)f(HTML)g -(header)f(is)j(printed;)d(the)h Fq(title)g Fv(attrib)n(ute)f(of)h(the)h -(element)396 4568 y(determines)e(the)i(title)f(of)g(the)h(HTML)f(page.) -f(Some)h(aspects)g(of)g(the)g(HTML)g(page)g(can)g(be)g(con\002gured)e -(by)h(setting)396 4676 y(certain)h(parameter)f(entities,)h(for)g(e)o -(xample)e(the)i(background)d(color)m(,)i(the)h(te)o(xt)g(color)m(,)f -(and)h(link)g(colors.)f(After)h(the)396 4784 y(header)m(,)f(the)h -Fq(body)g Fv(tag,)g(and)g(the)g(headline)f(ha)n(v)o(e)g(been)h -(printed,)f(the)h(contents)f(of)h(the)g(page)g(are)g(con)m(v)o(erted)e -(by)p Black 3798 5278 a Fr(36)p Black eop -%%Page: 37 37 -37 36 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(in)m(v)n(oking)e Fq(to_html)i Fv(on)g(all)g -(children)f(of)h(the)g(current)f(node)g(\(which)h(is)h(the)f(root)f -(node\).)g(Then,)g(the)h(footnotes)f(are)396 687 y(appended)f(to)j -(this)f(by)g(telling)g(the)g(global)f Fq(store)h Fv(object)g(to)g -(print)g(the)g(footnotes.)f(Finally)-5 b(,)19 b(the)h(end)g(tags)g(of)g -(the)396 795 y(HTML)g(pages)g(are)g(printed.)396 944 -y(This)h(class)g(is)g(an)f(e)o(xample)f(ho)n(w)g(to)i(access)g(the)f(v) -n(alue)f(of)h(an)g(attrib)n(ute:)g(The)g(v)n(alue)g(is)h(determined)d -(by)i(in)m(v)n(oking)396 1052 y Fq(self)44 b(#)h(node)f(#)h(attribute)e -("title")p Fv(.)20 b(As)h(this)f(attrib)n(ute)g(has)g(been)g(declared)f -(as)i(CD)m(A)-9 b(T)h(A)20 b(and)g(as)h(being)396 1160 -y(required,)d(the)j(v)n(alue)e(has)i(al)o(w)o(ays)f(the)g(form)g -Fq(Value)44 b(s)20 b Fv(where)g Fq(s)g Fv(is)h(the)g(string)e(v)n(alue) -h(of)g(the)g(attrib)n(ute.)396 1310 y(Y)-9 b(ou)20 b(can)g(also)g(see)h -(ho)n(w)f(entity)g(contents)f(can)h(be)g(accessed.)g(A)h(parameter)e -(entity)g(object)h(can)g(be)g(look)o(ed)f(up)h(by)396 -1417 y Fq(self)44 b(#)h(node)f(#)h(dtd)f(#)h(par_entity)e("name")p -Fv(,)20 b(and)f(by)h(in)m(v)n(oking)e Fq(replacement_text)g -Fv(the)i(v)n(alue)g(of)396 1525 y(the)g(entity)g(is)h(returned)e(after) -h(inner)f(parameter)g(and)g(character)g(entities)i(ha)n(v)o(e)f(been)f -(processed.)g(Note)h(that)g(you)396 1633 y(must)g(use)h -Fq(gen_entity)e Fv(instead)h(of)g Fq(par_entity)f Fv(to)h(access)h -(general)e(entities.)396 1855 y Fq(class)44 b(readme)g(=)486 -1952 y(object)g(\(self\))576 2049 y(inherit)f(shared)576 -2244 y(method)g(to_html)h(store)g(ch)h(=)665 2341 y(\(*)g(output)f -(header)f(*\))665 2438 y(output_string)396 2535 y(ch)i(")p -Fo(<)p Fq(!DOCTYPE)e(HTML)h(PUBLIC)g(\\"-//W3C//DTD)e(HTML)j(3.2)f -(Final//EN\\")p Fo(>)p Fq(";)665 2632 y(output_string)396 -2729 y(ch)h(")p Fo(<)p Fq(!-)f(WARNING!)f(This)h(is)h(a)g(generated)e -(file,)h(do)g(not)h(edit!)f(-)p Fo(>)p Fq(\\n";)665 2826 -y(let)h(title)f(=)396 2923 y(match)g(self)g(#)h(node)f(#)h(attribute)e -("title")h(with)576 3021 y(Value)g(s)g(-)p Fo(>)h Fq(s)486 -3118 y(|)g(_)f(-)p Fo(>)h Fq(assert)e(false)665 3215 -y(in)665 3312 y(let)i(html_header,)d(_)j(=)396 3409 y(try)g(\(self)f(#) -g(node)g(#)h(dtd)f(#)h(par_entity)e("readme:html:header"\))934 -3506 y(#)i(replacement_text)396 3603 y(with)f(WF_error)g(_)h(-)p -Fo(>)f Fq("",)g(false)g(in)665 3701 y(let)h(html_trailer,)d(_)j(=)396 -3798 y(try)g(\(self)f(#)g(node)g(#)h(dtd)f(#)h(par_entity)e -("readme:html:trailer"\))934 3895 y(#)i(replacement_text)396 -3992 y(with)f(WF_error)g(_)h(-)p Fo(>)f Fq("",)g(false)g(in)665 -4089 y(let)h(html_bgcolor,)d(_)j(=)396 4186 y(try)g(\(self)f(#)g(node)g -(#)h(dtd)f(#)h(par_entity)e("readme:html:bgcolor"\))934 -4283 y(#)i(replacement_text)396 4380 y(with)f(WF_error)g(_)h(-)p -Fo(>)f Fq("white",)f(false)h(in)665 4478 y(let)h(html_textcolor,)d(_)j -(=)396 4575 y(try)g(\(self)f(#)g(node)g(#)h(dtd)f(#)h(par_entity)e -("readme:html:textcolor"\))934 4672 y(#)i(replacement_text)396 -4769 y(with)f(WF_error)g(_)h(-)p Fo(>)f Fq("",)g(false)g(in)665 -4866 y(let)h(html_alinkcolor,)d(_)i(=)p Black 3797 5278 -a Fr(37)p Black eop -%%Page: 38 38 -38 37 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fq(try)45 b(\(self)f(#)g(node)g(#)h(dtd)f(#)h -(par_entity)e("readme:html:alinkcolor"\))934 676 y(#)i -(replacement_text)396 773 y(with)f(WF_error)g(_)h(-)p -Fo(>)f Fq("",)g(false)g(in)665 870 y(let)h(html_vlinkcolor,)d(_)i(=)396 -967 y(try)h(\(self)f(#)g(node)g(#)h(dtd)f(#)h(par_entity)e -("readme:html:vlinkcolor"\))934 1065 y(#)i(replacement_text)396 -1162 y(with)f(WF_error)g(_)h(-)p Fo(>)f Fq("",)g(false)g(in)665 -1259 y(let)h(html_linkcolor,)d(_)j(=)396 1356 y(try)g(\(self)f(#)g -(node)g(#)h(dtd)f(#)h(par_entity)e("readme:html:linkcolor"\))934 -1453 y(#)i(replacement_text)396 1550 y(with)f(WF_error)g(_)h(-)p -Fo(>)f Fq("",)g(false)g(in)665 1647 y(let)h(html_background,)d(_)i(=) -396 1745 y(try)h(\(self)f(#)g(node)g(#)h(dtd)f(#)h(par_entity)e -("readme:html:background"\))934 1842 y(#)i(replacement_text)396 -1939 y(with)f(WF_error)g(_)h(-)p Fo(>)f Fq("",)g(false)g(in)665 -2133 y(output_string)f(ch)h(")p Fo(<)p Fq(html)p Fo(><)p -Fq(header)p Fo(><)p Fq(title)p Fo(>)p Fq(\\n";)665 2230 -y(output_string)f(ch)h(\(escape_html)f(title\);)665 2327 -y(output_string)g(ch)h(")p Fo(<)p Fq(/title)p Fo(><)p -Fq(/header)p Fo(>)p Fq(\\n";)665 2424 y(output_string)f(ch)h(")p -Fo(<)p Fq(body)g(";)665 2522 y(List.iter)396 2619 y(\(fun)g -(\(name,value\))f(-)p Fo(>)531 2716 y Fq(if)h(value)g -Fo(<>)h Fq("")f(then)620 2813 y(output_string)f(ch)i(\(name)f(^)g -("=\\"")g(^)h(escape_html)e(value)h(^)h("\\")f("\)\))396 -2910 y([)h("bgcolor",)178 b(html_bgcolor;)486 3007 y("text",)313 -b(html_textcolor;)486 3104 y("link",)g(html_linkcolor;)486 -3202 y("alink",)268 b(html_alinkcolor;)486 3299 y("vlink",)g -(html_vlinkcolor;)396 3396 y(];)665 3493 y(output_string)43 -b(ch)h(")p Fo(>)p Fq(\\n";)665 3590 y(output_string)f(ch)h -(html_header;)665 3687 y(output_string)f(ch)h(")p Fo(<)p -Fq(h1)p Fo(>)p Fq(";)665 3784 y(output_string)f(ch)h(\(escape_html)f -(title\);)665 3882 y(output_string)g(ch)h(")p Fo(<)p -Fq(/h1)p Fo(>)p Fq(\\n";)665 3979 y(\(*)h(process)e(main)i(content:)e -(*\))665 4076 y(List.iter)396 4173 y(\(fun)h(n)h(-)p -Fo(>)f Fq(n)h(#)g(extension)e(#)i(to_html)e(store)h(ch\))396 -4270 y(\(self)g(#)h(node)f(#)h(sub_nodes\);)665 4367 -y(\(*)g(now)f(process)g(footnotes)f(*\))665 4464 y(store)h(#)h -(print_footnotes)d(ch;)665 4561 y(\(*)j(trailer)e(*\))665 -4659 y(output_string)g(ch)h(html_trailer;)665 4756 y(output_string)f -(ch)h(")p Fo(<)p Fq(/html)p Fo(>)p Fq(\\n";)p Black 3800 -5278 a Fr(38)p Black eop -%%Page: 39 39 -39 38 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 486 579 a Fq(end)396 676 y(;;)-2 1129 y Fp(2.4.8.)35 -b(Classes)h Fc(section)p Fp(,)31 b Fc(sect1)p Fp(,)g -Fc(sect2)p Fp(,)g(and)j Fc(sect3)396 1296 y Fv(As)21 -b(the)f(con)m(v)o(ersion)e(process)i(is)h(v)o(ery)e(similar)m(,)h(the)g -(con)m(v)o(ersion)d(classes)22 b(of)e(the)g(three)g(section)f(le)n(v)o -(els)i(are)f(deri)n(v)o(ed)396 1404 y(from)f(the)i(more)e(general)g -Fq(section)h Fv(class.)h(The)e(HTML)h(code)g(of)g(the)g(section)g(le)n -(v)o(els)g(only)f(dif)n(fers)h(in)g(the)g(type)g(of)396 -1512 y(the)g(headline,)f(and)h(because)f(of)h(this)h(the)f(classes)i -(describing)c(the)i(section)g(le)n(v)o(els)g(can)g(be)h(computed)d(by)i -(replacing)396 1620 y(the)g(class)i(ar)o(gument)17 b -Fq(the_tag)j Fv(of)g Fq(section)g Fv(by)f(the)i(HTML)e(name)h(of)g(the) -g(headline)f(tag.)396 1770 y(Section)h(elements)g(are)g(con)m(v)o -(erted)e(to)i(HTML)g(by)g(printing)e(a)j(headline)e(and)h(then)f(con)m -(v)o(erting)f(the)i(contents)f(of)h(the)396 1878 y(element)g(recursi)n -(v)o(ely)-5 b(.)18 b(More)h(precisely)-5 b(,)19 b(the)h(\002rst)h -(sub-element)e(is)i(al)o(w)o(ays)f(a)h Fq(title)f Fv(element,)f(and)h -(the)g(other)396 1985 y(elements)g(are)g(the)g(contents)g(of)g(the)g -(section.)g(This)g(structure)f(is)j(declared)c(in)j(the)f(DTD,)g(and)g -(it)h(is)g(guaranteed)d(that)396 2093 y(the)i(document)f(matches)g(the) -i(DTD.)f(Because)g(of)g(this)h(the)f(title)h(node)e(can)h(be)g -(separated)f(from)g(the)h(rest)h(without)f(an)o(y)396 -2201 y(checks.)396 2351 y(Both)g(the)h(title)g(node,)e(and)g(the)h -(body)f(nodes)h(are)g(then)f(con)m(v)o(erted)f(to)i(HTML)g(by)g -(calling)g Fq(to_html)f Fv(on)h(them.)396 2572 y Fq(class)44 -b(section)g(the_tag)g(=)486 2670 y(object)g(\(self\))576 -2767 y(inherit)f(shared)576 2961 y(val)h(tag)g(=)h(the_tag)576 -3155 y(method)e(to_html)h(store)g(ch)h(=)665 3252 y(let)g(sub_nodes)e -(=)i(self)f(#)g(node)h(#)f(sub_nodes)g(in)665 3350 y(match)g(sub_nodes) -g(with)486 3447 y(title_node)f(::)i(rest)f(-)p Fo(>)576 -3544 y Fq(output_string)e(ch)j(\(")p Fo(<)p Fq(")f(^)g(tag)h(^)f(")p -Fo(>)p Fq(\\n"\);)576 3641 y(title_node)f(#)h(extension)g(#)g(to_html)g -(store)g(ch;)576 3738 y(output_string)e(ch)j(\("\\n)p -Fo(<)p Fq(/")e(^)i(tag)f(^)h(")p Fo(>)p Fq("\);)576 3835 -y(List.iter)665 3932 y(\(fun)f(n)h(-)p Fo(>)f Fq(n)h(#)g(extension)e(#) -i(to_html)e(store)h(ch\))665 4029 y(rest)396 4127 y(|)h(_)g(-)p -Fo(>)576 4224 y Fq(assert)e(false)486 4321 y(end)396 -4418 y(;;)396 4612 y(class)h(sect1)g(=)h(section)f("h1";;)396 -4709 y(class)g(sect2)g(=)h(section)f("h3";;)396 4807 -y(class)g(sect3)g(=)h(section)f("h4";;)p Black 3800 5278 -a Fr(39)p Black eop -%%Page: 40 40 -40 39 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black -2 583 a Fp(2.4.9.)35 b(Classes)h Fc(map_tag)p -Fp(,)31 b Fc(p)p Fp(,)i Fc(em)p Fp(,)f Fc(ul)p Fp(,)h -Fc(li)396 751 y Fv(Se)n(v)o(eral)20 b(element)f(types)h(are)g(con)m(v)o -(erted)e(to)i(HTML)g(by)g(simply)g(mapping)e(them)i(to)g(corresponding) -d(HTML)396 859 y(element)j(types.)g(The)f(class)j Fq(map_tag)d -Fv(implements)g(this,)i(and)f(the)g(class)h(ar)o(gument)d -Fq(the_target_tag)396 967 y Fv(determines)h(the)i(tag)f(name)f(to)i -(map)e(to.)h(The)g(output)f(consists)i(of)f(the)g(start)h(tag,)f(the)g -(recursi)n(v)o(ely)e(con)m(v)o(erted)g(inner)396 1075 -y(elements,)i(and)g(the)g(end)f(tag.)396 1255 y Fq(class)44 -b(map_tag)g(the_target_tag)e(=)486 1352 y(object)i(\(self\))576 -1449 y(inherit)f(shared)576 1643 y(val)h(target_tag)f(=)i -(the_target_tag)576 1838 y(method)e(to_html)h(store)g(ch)h(=)665 -1935 y(output_string)e(ch)h(\(")p Fo(<)p Fq(")g(^)h(target_tag)e(^)i(") -p Fo(>)p Fq(\\n"\);)665 2032 y(List.iter)396 2129 y(\(fun)f(n)h(-)p -Fo(>)f Fq(n)h(#)g(extension)e(#)i(to_html)e(store)h(ch\))396 -2226 y(\(self)g(#)h(node)f(#)h(sub_nodes\);)665 2323 -y(output_string)e(ch)h(\("\\n)p Fo(<)p Fq(/")g(^)h(target_tag)e(^)h(")p -Fo(>)p Fq("\);)486 2420 y(end)396 2518 y(;;)396 2712 -y(class)g(p)h(=)g(map_tag)e("p";;)396 2809 y(class)h(em)h(=)f(map_tag)g -("b";;)396 2906 y(class)g(ul)h(=)f(map_tag)g("ul";;)396 -3003 y(class)g(li)h(=)f(map_tag)g("li";;)-2 3456 y Fp(2.4.10.)36 -b(Class)f Fc(br)396 3624 y Fv(Element)20 b(of)g(type)f -Fq(br)i Fv(are)f(mapped)f(to)h(the)g(same)g(HTML)g(type.)g(Note)g(that) -g(HTML)g(forbids)f(the)h(end)g(tag)g(of)g Fq(br)p Fv(.)396 -3804 y Fq(class)44 b(br)h(=)486 3901 y(object)f(\(self\))576 -3998 y(inherit)f(shared)576 4192 y(method)g(to_html)h(store)g(ch)h(=) -665 4289 y(output_string)e(ch)h(")p Fo(<)p Fq(br)p Fo(>)p -Fq(\\n";)665 4387 y(List.iter)396 4484 y(\(fun)g(n)h(-)p -Fo(>)f Fq(n)h(#)g(extension)e(#)i(to_html)e(store)h(ch\))396 -4581 y(\(self)g(#)h(node)f(#)h(sub_nodes\);)486 4678 -y(end)396 4775 y(;;)p Black 3800 5278 a Fr(40)p Black -eop -%%Page: 41 41 -41 40 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black -2 583 a Fp(2.4.11.)36 b(Class)f Fc(code)396 751 -y Fv(The)20 b Fq(code)g Fv(type)g(is)h(con)m(v)o(erted)d(to)i(a)h -Fq(pre)f Fv(section)g(\(preformatted)d(te)o(xt\).)i(As)i(the)g(meaning) -d(of)i(tabs)h(is)g(unspeci\002ed)e(in)396 859 y(HTML,)h(tabs)g(are)h(e) -o(xpanded)c(to)k(spaces.)396 1039 y Fq(class)44 b(code)g(=)486 -1136 y(object)g(\(self\))576 1233 y(inherit)f(shared)576 -1427 y(method)g(to_html)h(store)g(ch)h(=)665 1525 y(let)g(data)f(=)g -(self)h(#)f(node)g(#)h(data)f(in)665 1622 y(\(*)h(convert)e(tabs)i(*\)) -665 1719 y(let)g(l)f(=)h(String.length)e(data)h(in)665 -1816 y(let)h(rec)f(preprocess)f(i)i(column)f(=)396 1913 -y(\(*)h(this)f(is)g(very)h(ineffective)e(but)h(comprehensive:)e(*\))396 -2010 y(if)j(i)f Fo(<)h Fq(l)g(then)486 2107 y(match)f(data.[i])f(with) -665 2205 y('\\t')h(-)p Fo(>)396 2302 y Fq(let)h(n)f(=)h(8)g(-)f -(\(column)g(mod)g(8\))h(in)396 2399 y(String.make)e(n)i(')g(')f(^)h -(preprocess)e(\(i+1\))h(\(column)g(+)g(n\))576 2496 y(|)g('\\n')g(-)p -Fo(>)396 2593 y Fq("\\n")g(^)h(preprocess)e(\(i+1\))h(0)576 -2690 y(|)g(c)h(-)p Fo(>)396 2787 y Fq(String.make)e(1)i(c)g(^)f -(preprocess)f(\(i+1\))h(\(column)g(+)h(1\))396 2884 y(else)486 -2982 y("")665 3079 y(in)665 3176 y(output_string)e(ch)h(")p -Fo(<)p Fq(p)p Fo(><)p Fq(pre)p Fo(>)p Fq(";)665 3273 -y(output_string)f(ch)h(\(escape_html)f(\(preprocess)g(0)i(0\)\);)665 -3370 y(output_string)e(ch)h(")p Fo(<)p Fq(/pre)p Fo(><)p -Fq(/p)p Fo(>)p Fq(";)486 3564 y(end)396 3662 y(;;)-2 -4114 y Fp(2.4.12.)36 b(Class)f Fc(a)396 4282 y Fv(Hyperlinks,)19 -b(e)o(xpressed)g(by)g(the)i Fq(a)f Fv(element)g(type,)f(are)h(con)m(v)o -(erted)e(to)i(the)g(HTML)g Fq(a)h Fv(type.)e(If)i(the)f(tar)o(get)f(of) -h(the)396 4390 y(hyperlink)e(is)j(gi)n(v)o(en)d(by)i -Fq(href)p Fv(,)g(the)g(URL)g(of)g(this)g(attrib)n(ute)g(can)g(be)g -(used)g(directly)-5 b(.)18 b(Alternati)n(v)o(ely)-5 b(,)18 -b(the)i(tar)o(get)f(can)h(be)396 4498 y(gi)n(v)o(en)f(by)h -Fq(readmeref)f Fv(in)i(which)e(case)i(the)f(".html")g(suf)n(\002x)f -(must)i(be)f(added)f(to)h(the)g(\002le)h(name.)396 4647 -y(Note)f(that)h(within)f Fq(a)g Fv(only)g(#PCD)m(A)-9 -b(T)h(A)20 b(is)h(allo)n(wed,)e(so)i(the)f(contents)f(can)h(be)g(con)m -(v)o(erted)e(directly)h(by)h(applying)396 4755 y Fq(escape_html)f -Fv(to)i(the)f(character)f(data)h(contents.)p Black 3800 -5278 a Fr(41)p Black eop -%%Page: 42 42 -42 41 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fq(class)44 b(a)h(=)486 676 y(object)f(\(self\))576 -773 y(inherit)f(shared)576 967 y(method)g(to_html)h(store)g(ch)h(=)665 -1065 y(output_string)e(ch)h(")p Fo(<)p Fq(a)h(";)665 -1162 y(let)g(href)f(=)396 1259 y(match)g(self)g(#)h(node)f(#)h -(attribute)e("href")h(with)576 1356 y(Value)g(v)g(-)p -Fo(>)h Fq(escape_html)e(v)486 1453 y(|)i(Valuelist)e(_)i(-)p -Fo(>)f Fq(assert)g(false)486 1550 y(|)h(Implied_value)d(-)p -Fo(>)665 1647 y Fq(begin)i(match)g(self)g(#)h(node)f(#)h(attribute)e -("readmeref")g(with)486 1745 y(Value)h(v)h(-)p Fo(>)f -Fq(escape_html)f(v)i(^)f(".html")396 1842 y(|)h(Valuelist)e(_)i(-)p -Fo(>)f Fq(assert)g(false)396 1939 y(|)h(Implied_value)e(-)p -Fo(>)576 2036 y Fq("")665 2133 y(end)665 2230 y(in)665 -2327 y(if)i(href)f Fo(<>)g Fq("")h(then)396 2424 y(output_string)e(ch)h -(\("href=\\"")88 b(^)45 b(href)f(^)h("\\""\);)665 2522 -y(output_string)e(ch)h(")p Fo(>)p Fq(";)665 2619 y(output_string)f(ch)h -(\(escape_html)f(\(self)h(#)h(node)f(#)h(data\)\);)665 -2716 y(output_string)e(ch)h(")p Fo(<)p Fq(/a)p Fo(>)p -Fq(";)486 2910 y(end)396 3007 y(;;)-2 3460 y Fp(2.4.13.)36 -b(Class)f Fc(footnote)396 3628 y Fv(The)20 b Fq(footnote)g -Fv(class)h(has)f(tw)o(o)h(methods:)e Fq(to_html)g Fv(to)i(con)m(v)o -(ert)d(the)i(footnote)f(reference)f(to)i(HTML,)g(and)396 -3736 y Fq(footnote_to_html)e Fv(to)j(con)m(v)o(ert)d(the)i(footnote)f -(te)o(xt)h(itself.)396 3885 y(The)g(footnote)f(reference)f(is)j(con)m -(v)o(erted)d(to)i(a)h(local)f(hyperlink;)e(more)h(precisely)-5 -b(,)19 b(to)h(tw)o(o)h(anchor)d(tags)j(which)e(are)396 -3993 y(connected)g(with)h(each)g(other)-5 b(.)19 b(The)h(te)o(xt)g -(anchor)f(points)h(to)g(the)g(footnote)f(anchor)m(,)f(and)h(the)i -(footnote)d(anchor)h(points)396 4101 y(to)i(the)f(te)o(xt)g(anchor)-5 -b(.)396 4250 y(The)20 b(footnote)f(must)h(be)g(allocated)f(in)i(the)f -Fq(store)g Fv(object.)f(By)i(allocating)e(the)h(footnote,)f(you)g(get)h -(the)g(number)f(of)396 4358 y(the)h(footnote,)f(and)g(the)i(te)o(xt)f -(of)f(the)i(footnote)d(is)j(stored)f(until)g(the)g(end)g(of)g(the)g -(HTML)g(page)f(is)j(reached)c(when)i(the)396 4466 y(footnotes)f(can)h -(be)g(printed.)f(The)h Fq(to_html)f Fv(method)g(stores)i(simply)e(the)i -(object)e(itself,)i(such)f(that)g(the)396 4574 y Fq(footnote_to_html)e -Fv(method)h(is)i(in)m(v)n(ok)o(ed)e(on)g(the)i(same)f(object)g(that)g -(encountered)d(the)k(footnote.)p Black 3800 5278 a Fr(42)p -Black eop -%%Page: 43 43 -43 42 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black 396 579 a Fv(The)g Fq(to_html)g Fv(only)f(allocates)h(the)h -(footnote,)d(and)h(prints)h(the)g(reference)f(anchor)m(,)f(b)n(ut)i(it) -h(does)f(not)g(print)g(nor)396 687 y(con)m(v)o(ert)e(the)j(contents)e -(of)h(the)g(note.)g(This)g(is)h(deferred)d(until)j(the)f(footnotes)e -(actually)i(get)g(printed,)f(i.e.)h(the)g(recursi)n(v)o(e)396 -795 y(call)h(of)f Fq(to_html)f Fv(on)h(the)g(sub)g(nodes)g(is)h(done)e -(by)h Fq(footnote_to_html)p Fv(.)396 944 y(Note)g(that)h(this)f -(technique)f(does)h(not)g(w)o(ork)f(if)i(you)e(mak)o(e)h(another)f -(footnote)f(within)i(a)h(footnote;)d(the)i(second)396 -1052 y(footnote)f(gets)h(allocated)g(b)n(ut)g(not)g(printed.)396 -1274 y Fq(class)44 b(footnote)g(=)486 1371 y(object)g(\(self\))576 -1468 y(inherit)f(shared)576 1662 y(val)h(mutable)g(footnote_number)e(=) -j(0)576 1857 y(method)e(to_html)h(store)g(ch)h(=)665 -1954 y(let)g(number)e(=)396 2051 y(store)h(#)h(alloc_footnote)d(\(self) -i(:)h(#shared)f(:)p Fo(>)g Fq(footnote_printer\))e(in)665 -2148 y(let)j(foot_anchor)e(=)396 2245 y("footnote")g(^)i(string_of_int) -e(number)h(in)665 2342 y(let)h(text_anchor)e(=)396 2439 -y("textnote")g(^)i(string_of_int)e(number)h(in)665 2537 -y(footnote_number)f Fo(<)p Fq(-)h(number;)665 2634 y(output_string)f -(ch)h(\()h(")p Fo(<)p Fq(a)f(name=\\"")g(^)g(text_anchor)f(^)i("\\")f -(href=\\"#")g(^)441 2731 y(foot_anchor)f(^)i("\\")p Fo(>)p -Fq([")e(^)i(string_of_int)e(number)h(^)441 2828 y("])p -Fo(<)p Fq(/a)p Fo(>)p Fq(")g(\))576 3022 y(method)f(footnote_to_html)g -(store)h(ch)g(=)665 3119 y(\(*)h(prerequisite:)d(we)j(are)f(in)h(a)f -(definition)g(list)g Fo(<)p Fq(dl)p Fo(>)p Fq(...)p Fo(<)p -Fq(/dl)p Fo(>)e Fq(*\))665 3217 y(let)j(foot_anchor)e(=)396 -3314 y("footnote")g(^)i(string_of_int)e(footnote_number)f(in)665 -3411 y(let)j(text_anchor)e(=)396 3508 y("textnote")g(^)i(string_of_int) -e(footnote_number)f(in)665 3605 y(output_string)h(ch)h(\(")p -Fo(<)p Fq(dt)p Fo(><)p Fq(a)g(name=\\"")f(^)i(foot_anchor)e(^)h("\\")h -(href=\\"#")e(^)396 3702 y(text_anchor)g(^)i("\\")p Fo(>)p -Fq([")f(^)g(string_of_int)f(footnote_number)f(^)396 3799 -y("])p Fo(<)p Fq(/a)p Fo(><)p Fq(/dt)p Fo(>)p Fq(\\n)p -Fo(<)p Fq(dd)p Fo(>)p Fq("\);)665 3896 y(List.iter)396 -3994 y(\(fun)i(n)h(-)p Fo(>)f Fq(n)h(#)g(extension)e(#)i(to_html)e -(store)h(ch\))396 4091 y(\(self)g(#)h(node)f(#)h(sub_nodes\);)665 -4188 y(output_string)e(ch)h(\("\\n)p Fo(<)p Fq(/dd)p -Fo(>)p Fq("\))486 4382 y(end)396 4479 y(;;)p Black 3800 -5278 a Fr(43)p Black eop -%%Page: 44 44 -44 43 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black -2 583 a Fp(2.4.14.)36 b(The)d(speci\002cation)j(of)e(the)f -(document)i(model)396 751 y Fv(This)21 b(code)e(sets)i(up)f(the)g(hash) -g(table)g(that)h(connects)e(element)h(types)g(with)g(the)g(e)o(x)o -(emplars)f(of)h(the)g(e)o(xtension)f(classes)396 859 -y(that)i(con)m(v)o(ert)d(the)i(elements)g(to)g(HTML.)396 -1039 y Fq(open)44 b(Pxp_yacc)396 1233 y(let)h(tag_map)e(=)486 -1330 y(make_spec_from_alist)576 1427 y(~data_exemplar:\(new)e -(data_impl)j(\(new)g(only_data\)\))576 1525 y -(~default_element_exemplar:\(new)39 b(element_impl)k(\(new)h -(no_markup\)\))576 1622 y(~element_alist:)665 1719 y([)h("readme",)e -(\(new)h(element_impl)f(\(new)h(readme\)\);)396 1816 -y("sect1",)89 b(\(new)44 b(element_impl)f(\(new)h(sect1\)\);)396 -1913 y("sect2",)89 b(\(new)44 b(element_impl)f(\(new)h(sect2\)\);)396 -2010 y("sect3",)89 b(\(new)44 b(element_impl)f(\(new)h(sect3\)\);)396 -2107 y("title",)89 b(\(new)44 b(element_impl)f(\(new)h(no_markup\)\);) -396 2205 y("p",)269 b(\(new)44 b(element_impl)f(\(new)h(p\)\);)396 -2302 y("br",)224 b(\(new)44 b(element_impl)f(\(new)h(br\)\);)396 -2399 y("code",)134 b(\(new)44 b(element_impl)f(\(new)h(code\)\);)396 -2496 y("em",)224 b(\(new)44 b(element_impl)f(\(new)h(em\)\);)396 -2593 y("ul",)224 b(\(new)44 b(element_impl)f(\(new)h(ul\)\);)396 -2690 y("li",)224 b(\(new)44 b(element_impl)f(\(new)h(li\)\);)396 -2787 y("footnote",)f(\(new)h(element_impl)f(\(new)h(footnote)g(:)h -(#shared)e(:)p Fo(>)i Fq(shared\)\);)396 2884 y("a",)269 -b(\(new)44 b(element_impl)f(\(new)h(a\)\);)665 2982 y(])576 -3079 y(\(\))396 3176 y(;;)-2 3678 y Fx(Notes)p Black -396 3857 a Fv(1.)p Black 70 w(Elements)20 b(may)g(also)g(contain)f -(processing)g(instructions.)g(Unlik)o(e)h(other)f(document)g(models,)g -(PXP)i(separates)529 3965 y(processing)e(instructions)g(from)g(the)i -(rest)f(of)g(the)g(te)o(xt)g(and)g(pro)o(vides)e(a)j(second)e(interf)o -(ace)h(to)g(access)h(them)529 4073 y(\(method)e Fq(pinstr)p -Fv(\).)g(Ho)n(we)n(v)o(er)m(,)f(there)h(is)j(a)e(parser)g(option)f(\()p -Fq(enable_pinstr_nodes)p Fv(\))e(which)i(changes)g(the)529 -4181 y(beha)n(viour)f(of)i(the)g(parser)g(such)g(that)g(e)o(xtra)g -(nodes)f(for)h(processing)e(instructions)i(are)g(included)e(into)i(the) -h(tree.)529 4320 y Fi(Furthermore,)e(the)g(tree)g(does)g(normally)h -(not)f(contain)h(nodes)g(for)e(XML)h(comments;)h(the)o(y)f(are)g -(ignored)h(by)f(def)o(ault.)g(Again,)529 4417 y(there)g(is)g(an)g -(option)h(\()p Fh(enable_comment_nodes)p Fi(\))25 b(changing)c(this.)p -Black 396 4566 a Fv(2.)p Black 70 w(Due)f(to)h(the)f(typing)f(system)h -(it)h(is)g(more)e(or)h(less)i(impossible)d(to)i(deri)n(v)o(e)d(recursi) -n(v)o(e)h(classes)i(in)g(O'Caml.)f(T)-7 b(o)20 b(get)529 -4674 y(around)e(this,)j(it)g(is)g(common)d(practice)i(to)g(put)g(the)g -(modi\002able)f(or)h(e)o(xtensible)f(part)h(of)g(recursi)n(v)o(e)f -(objects)h(into)529 4782 y(parallel)g(objects.)p Black -3800 5278 a Fr(44)p Black eop -%%Page: 45 45 -45 44 bop Black 3136 67 a Fr(Chapter)20 b(2.)g(Using)g(PXP)p -Black Black 396 579 a Fv(3.)p Black 70 w(The)g(problem)e(is)k(that)e -(the)g(subclass)h(is)g(usually)e(not)h(a)h(subtype)e(in)h(this)h(case)f -(because)g(O'Caml)g(has)h(a)529 687 y(contra)n(v)n(ariant)d(subtyping)g -(rule.)p Black 3800 5278 a Fr(45)p Black eop -%%Page: 46 46 -46 45 bop Black Black -2 621 a Fs(Chapter)48 b(3.)f(The)h(objects)g -(representing)g(the)-2 845 y(document)396 1093 y Fr(This)21 -b(description)e(might)h(be)g(out-of-date)o(.)e(See)i(the)g(module)f -(interface)h(\002les)g(for)h(updated)d(information.)-2 -1470 y Fx(3.1.)39 b(The)g Fb(document)44 b Fx(c)m(lass)396 -1722 y Fq(class)g([)h('ext)f(])h(document)e(:)486 1819 -y(Pxp_types.collect_warnings)d(->)486 1916 y(object)576 -2013 y(method)j(init_xml_version)g(:)h(string)g(->)h(unit)576 -2111 y(method)e(init_root)h(:)g('ext)h(node)f(->)g(unit)576 -2305 y(method)f(xml_version)g(:)i(string)576 2402 y(method)e -(xml_standalone)g(:)i(bool)576 2499 y(method)e(dtd)i(:)f(dtd)576 -2596 y(method)f(root)i(:)f('ext)g(node)576 2791 y(method)f(encoding)h -(:)h(Pxp_types.rep_encoding)576 2985 y(method)e(add_pinstr)h(:)g -(proc_instruction)e(->)j(unit)576 3082 y(method)e(pinstr)h(:)h(string)f -(->)g(proc_instruction)e(list)576 3179 y(method)h(pinstr_names)g(:)i -(string)f(list)576 3373 y(method)f(write)h(:)h(Pxp_types.output_stream) -c(->)k(Pxp_types.encoding)c(->)k(unit)486 3568 y(end)396 -3665 y(;;)396 3856 y Fv(The)20 b(methods)f(be)o(ginning)f(with)i -Fq(init_)g Fv(are)g(only)g(for)f(internal)h(use)g(of)g(the)g(parser)-5 -b(.)p Black 396 4088 a Ft(\225)p Black 60 w Fq(xml_version)p -Fv(:)19 b(returns)h(the)g(v)o(ersion)f(string)h(at)g(the)g(be)o -(ginning)e(of)i(the)g(document.)e(F)o(or)i(e)o(xample,)f("1.0")g(is)479 -4196 y(returned)g(if)h(the)g(document)f(be)o(gins)g(with)h -Fo(<)p Fq(?xml)44 b(version="1.0"?)p Fo(>)p Fv(.)p Black -396 4304 a Ft(\225)p Black 60 w Fq(xml_standalone)p Fv(:)19 -b(returns)g(the)h(boolean)f(v)n(alue)g(of)h Fq(standalone)f -Fv(declaration)g(in)h(the)h(XML)f(declaration.)e(If)479 -4412 y(the)i Fq(standalone)g Fv(attrib)n(ute)f(is)i(missing,)f -Fq(false)g Fv(is)h(returned.)p Black 396 4520 a Ft(\225)p -Black 60 w Fq(dtd)p Fv(:)g(returns)e(a)i(reference)d(to)i(the)h(global) -e(DTD)h(object.)p Black 396 4628 a Ft(\225)p Black 60 -w Fq(root)p Fv(:)g(returns)g(a)g(reference)f(to)h(the)g(root)g -(element.)p Black 396 4736 a Ft(\225)p Black 60 w Fq(encoding)p -Fv(:)g(returns)f(the)h(internal)g(encoding)e(of)i(the)g(document.)e -(This)i(means)g(that)g(all)h(strings)f(of)g(which)g(the)479 -4844 y(document)e(consists)j(are)f(encoded)f(in)h(this)h(character)e -(set.)p Black 3798 5278 a Fr(46)p Black eop -%%Page: 47 47 -47 46 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black Black 396 579 a Ft(\225)p -Black 60 w Fq(pinstr)p Fv(:)g(returns)f(the)i(processing)d -(instructions)i(outside)f(the)h(DTD)h(and)e(outside)h(the)g(root)g -(element.)f(The)479 687 y(ar)o(gument)f(passed)i(to)h(the)f(method)f -(names)g(a)i Fr(tar)m(g)o(et)q Fv(,)g(and)e(the)h(method)f(returns)g -(all)i(instructions)e(with)i(this)g(tar)o(get.)479 795 -y(The)f(tar)o(get)f(is)j(the)e(\002rst)h(w)o(ord)e(inside)h -Fo(<)p Fq(?)h Fv(and)e Fq(?)p Fo(>)p Fv(.)p Black 396 -903 a Ft(\225)p Black 60 w Fq(pinstr_names)p Fv(:)g(returns)g(the)i -(names)e(of)h(the)h(processing)d(instructions)p Black -396 1011 a Ft(\225)p Black 60 w Fq(add_pinstr)p Fv(:)h(adds)h(another)f -(processing)g(instruction.)f(This)j(method)e(is)i(used)f(by)f(the)h -(parser)g(itself)h(to)f(enter)g(the)479 1119 y(instructions)f(returned) -g(by)h Fq(pinstr)p Fv(,)f(b)n(ut)h(you)g(can)g(also)g(enter)g -(additional)f(instructions.)p Black 396 1226 a Ft(\225)p -Black 60 w Fq(write)p Fv(:)h(writes)h(the)f(document)e(to)j(the)f -(passed)g(stream)g(as)h(XML)f(te)o(xt)g(using)g(the)g(passed)g(\(e)o -(xternal\))e(encoding.)479 1334 y(The)i(generated)f(te)o(xt)h(is)h(al)o -(w)o(ays)f(v)n(alid)g(XML)g(and)g(can)g(be)g(parsed)g(by)f(PXP;)i(ho)n -(we)n(v)o(er)m(,)d(the)i(te)o(xt)g(is)h(badly)479 1442 -y(formatted)e(\(this)h(is)h(not)f(a)h(pretty)e(printer\).)-2 -1861 y Fx(3.2.)39 b(The)g(c)m(lass)g(type)g Fb(node)396 -2041 y Fv(From)20 b Fq(Pxp_document)p Fv(:)396 2221 y -Fq(type)44 b(node_type)g(=)486 2318 y(T_data)396 2415 -y(|)h(T_element)e(of)i(string)396 2512 y(|)g(T_super_root)396 -2609 y(|)g(T_pinstr)e(of)i(string)396 2706 y(|)g(T_comment)396 -2804 y Fn(and)g(some)f(other,)g(reserved)f(types)396 -2901 y Fq(;;)396 3095 y(class)h(type)g([)h('ext)f(])h(node)f(=)486 -3192 y(object)g(\('self\))576 3289 y(constraint)f('ext)h(=)h('ext)f -(node)g(#extension)576 3484 y(\(*)g Fn(General)g(observers)f -Fq(*\))576 3678 y(method)g(extension)h(:)g('ext)576 3775 -y(method)f(dtd)i(:)f(dtd)576 3872 y(method)f(parent)h(:)h('ext)f(node) -576 3969 y(method)f(root)i(:)f('ext)g(node)576 4066 y(method)f -(sub_nodes)h(:)g('ext)h(node)f(list)576 4164 y(method)f(iter_nodes)h(:) -g(\('ext)g(node)g(-)p Fo(>)h Fq(unit\))f(-)p Fo(>)g Fq(unit)576 -4261 y(method)f(iter_nodes_sibl)g(:)889 4358 y(\('ext)h(node)h(option)e -(-)p Fo(>)i Fq('ext)f(node)g(-)p Fo(>)g Fq('ext)h(node)f(option)g(-)p -Fo(>)g Fq(unit\))g(-)396 4455 y Fo(>)h Fq(unit)576 4552 -y(method)e(node_type)h(:)g(node_type)576 4649 y(method)f(encoding)h(:)h -(Pxp_types.rep_encoding)576 4746 y(method)e(data)i(:)f(string)576 -4843 y(method)f(position)h(:)h(\(string)e(*)i(int)f(*)h(int\))p -Black 3797 5278 a Fr(47)p Black eop -%%Page: 48 48 -48 47 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 576 579 a Fq(method)43 -b(comment)h(:)h(string)f(option)576 676 y(method)f(pinstr)h(:)h(string) -f(-)p Fo(>)g Fq(proc_instruction)e(list)576 773 y(method)h -(pinstr_names)g(:)i(string)f(list)576 870 y(method)f(write)h(:)h -(Pxp_types.output_stream)c(->)k(Pxp_types.encoding)c(->)k(unit)576 -1065 y(\(*)f Fn(Attribute)f(observers)h Fq(*\))576 1259 -y(method)f(attribute)h(:)g(string)g(-)p Fo(>)h Fq(Pxp_types.att_value) -576 1356 y(method)e(required_string_attribute)e(:)k(string)f(-)p -Fo(>)g Fq(string)576 1453 y(method)f(optional_string_attribute)e(:)k -(string)f(-)p Fo(>)g Fq(string)g(option)576 1550 y(method)f -(required_list_attribute)e(:)k(string)f(-)p Fo(>)g Fq(string)g(list)576 -1647 y(method)f(optional_list_attribute)e(:)k(string)f(-)p -Fo(>)g Fq(string)g(list)576 1745 y(method)f(attribute_names)g(:)h -(string)g(list)576 1842 y(method)f(attribute_type)g(:)i(string)e(-)p -Fo(>)i Fq(Pxp_types.att_type)576 1939 y(method)e(attributes)h(:)g -(\(string)g(*)h(Pxp_types.att_value\))c(list)576 2036 -y(method)i(id_attribute_name)f(:)j(string)576 2133 y(method)e -(id_attribute_value)f(:)j(string)576 2230 y(method)e -(idref_attribute_names)f(:)i(string)576 2424 y(\(*)g -Fn(Modifying)f(methods)h Fq(*\))576 2619 y(method)f(add_node)h(:)h -(?force:bool)e(-)p Fo(>)h Fq('ext)g(node)g(-)p Fo(>)h -Fq(unit)576 2716 y(method)e(add_pinstr)h(:)g(proc_instruction)e(-)p -Fo(>)j Fq(unit)576 2813 y(method)e(delete)h(:)h(unit)576 -2910 y(method)e(set_nodes)h(:)g('ext)h(node)f(list)g(-)p -Fo(>)g Fq(unit)576 3007 y(method)f(quick_set_attributes)f(:)j(\(string) -e(*)i(Pxp_types.att_value\))c(list)j(-)p Fo(>)h Fq(unit)576 -3104 y(method)e(set_comment)g(:)i(string)f(option)g(-)p -Fo(>)g Fq(unit)576 3299 y(\(*)g Fn(Cloning)g(methods)f -Fq(*\))576 3493 y(method)g(orphaned_clone)g(:)i('self)576 -3590 y(method)e(orphaned_flat_clone)f(:)j('self)576 3687 -y(method)e(create_element)g(:)1024 3784 y(?position:\(string)f(*)j(int) -f(*)h(int\))f(-)p Fo(>)1024 3882 y Fq(dtd)g(-)p Fo(>)h -Fq(node_type)e(-)p Fo(>)h Fq(\(string)g(*)h(string\))e(list)h(-)p -Fo(>)1203 3979 y Fq('ext)g(node)576 4076 y(method)f(create_data)g(:)i -(dtd)f(-)p Fo(>)h Fq(string)f(-)p Fo(>)g Fq('ext)g(node)576 -4173 y(method)f(keep_always_whitespace_mode)e(:)j(unit)576 -4367 y(\(*)g Fn(Validating)f(methods)h Fq(*\))576 4561 -y(method)f(local_validate)g(:)i(?use_dfa:bool)d(->)j(unit)f(->)g(unit) -576 4756 y(\(*)g(...)g(Internal)g(methods)g(are)g(undocumented.)f(*\))p -Black 3800 5278 a Fr(48)p Black eop -%%Page: 49 49 -49 48 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 486 579 a Fq(end)396 -676 y(;;)396 867 y Fv(In)g(the)g(module)f Fq(Pxp_types)g -Fv(you)h(can)g(\002nd)g(another)e(type)i(de\002nition)f(that)h(is)i -(important)c(in)j(this)f(conte)o(xt:)396 1047 y Fq(type)44 -b(Pxp_types.att_value)e(=)576 1144 y(Value)223 b(of)44 -b(string)486 1241 y(|)h(Valuelist)e(of)h(string)g(list)486 -1339 y(|)h(Implied_value)396 1436 y(;;)-2 1847 y Fp(3.2.1.)35 -b(The)f(structure)f(of)g(document)i(trees)396 2015 y -Fv(A)21 b(node)e(represents)g(either)h(an)g(element)g(or)g(a)g -(character)f(data)h(section.)g(There)g(are)g(tw)o(o)g(classes)h -(implementing)d(the)396 2122 y(tw)o(o)j(aspects)f(of)g(nodes:)g -Fq(element_impl)e Fv(and)i Fq(data_impl)p Fv(.)f(The)h(latter)g(class)h -(does)f(not)g(implement)f(all)i(methods)396 2230 y(because)f(some)g -(methods)f(do)h(not)g(mak)o(e)f(sense)i(for)e(data)h(nodes.)396 -2380 y(\(Note:)g(PXP)h(also)g(supports)e(a)h(mode)g(which)f(forces)h -(that)g(processing)f(instructions)g(and)h(comments)f(are)396 -2488 y(represented)g(as)i(nodes)e(of)h(the)g(document)e(tree.)i(Ho)n -(we)n(v)o(er)m(,)e(these)j(nodes)e(are)h(instances)g(of)g -Fq(element_impl)f Fv(with)396 2596 y(node)g(types)h Fq(T_pinstr)g -Fv(and)f Fq(T_comment)p Fv(,)g(respecti)n(v)o(ely)-5 -b(.)18 b(This)j(mode)e(must)h(be)g(e)o(xplicitly)g(con\002gured;)d(the) -k(basic)396 2704 y(representation)d(kno)n(ws)i(only)f(element)h(and)f -(data)h(nodes.\))396 2853 y(The)g(follo)n(wing)f(\002gure)g(\()p -Fr(A)h(tr)m(ee)h(with)g(element)f(nodes,)f(data)g(nodes,)h(and)f -(attrib)n(utes)p Fv(\))h(sho)n(ws)g(an)g(e)o(xample)f(ho)n(w)h(a)396 -2961 y(tree)g(is)i(constructed)c(from)h(element)h(and)f(data)i(nodes.)e -(The)h(circular)f(areas)h(represent)f(element)h(nodes)f(whereas)h(the) -396 3069 y(o)o(v)n(als)f(denote)f(data)i(nodes.)e(Only)h(elements)g -(may)g(ha)n(v)o(e)g(subnodes;)f(data)h(nodes)g(are)g(al)o(w)o(ays)h -(lea)n(v)o(es)f(of)h(the)f(tree.)g(The)396 3177 y(subnodes)g(of)h(an)g -(element)g(can)g(be)g(either)g(element)f(or)h(data)g(nodes;)g(in)g -(both)f(cases)i(the)g(O'Caml)f(objects)g(storing)f(the)396 -3285 y(nodes)h(ha)n(v)o(e)f(the)i(class)g(type)e Fq(node)p -Fv(.)396 3434 y(Attrib)n(utes)h(\(the)g(clouds)g(in)g(the)g(picture\))f -(are)h(not)g(directly)g(inte)o(grated)e(into)i(the)g(tree;)h(there)e -(is)i(al)o(w)o(ays)g(an)f(e)o(xtra)g(link)396 3542 y(to)h(the)f(attrib) -n(ute)g(list.)h(This)f(is)h(also)g(true)f(for)f(processing)g -(instructions)g(\(not)h(sho)n(wn)f(in)h(the)h(picture\).)d(This)j -(means)396 3650 y(that)g(there)e(are)h(separated)g(access)g(methods)g -(for)f(attrib)n(utes)h(and)g(processing)f(instructions.)p -Black 3800 5278 a Fr(49)p Black eop -%%Page: 50 50 -50 49 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(Figur)o(e)g(3-1.)f(A)i -(tr)o(ee)e(with)i(element)f(nodes,)h(data)e(nodes,)i(and)f(attrib)n -(utes)396 2578 y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 2578 a @beginspecial 0 @llx 0 @lly -329 @urx 218 @ury 3290 @rwi @setspecial -%%BeginDocument: pic/node_term.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/node_term.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 329 218 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --1.0 251.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/reencdict 12 dict def /ReEncode { reencdict begin -/newcodesandnames exch def /newfontname exch def /basefontname exch def -/basefontdict basefontname findfont def /newfont basefontdict maxlength dict def -basefontdict { exch dup /FID ne { dup /Encoding eq -{ exch dup length array copy newfont 3 1 roll put } -{ exch newfont 3 1 roll put } ifelse } { pop pop } ifelse } forall -newfont /FontName newfontname put newcodesandnames aload pop -128 1 255 { newfont /Encoding get exch /.notdef put } for -newcodesandnames length 2 idiv { newfont /Encoding get 3 1 roll put } repeat -newfontname newfont definefont pop end } def -/isovec [ -8#200 /grave 8#201 /acute 8#202 /circumflex 8#203 /tilde -8#204 /macron 8#205 /breve 8#206 /dotaccent 8#207 /dieresis -8#210 /ring 8#211 /cedilla 8#212 /hungarumlaut 8#213 /ogonek 8#214 /caron -8#220 /dotlessi 8#230 /oe 8#231 /OE -8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling -8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis -8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot -8#255 /endash 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus -8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph -8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine -8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf -8#276 /threequarters 8#277 /questiondown 8#300 /Agrave 8#301 /Aacute -8#302 /Acircumflex 8#303 /Atilde 8#304 /Adieresis 8#305 /Aring -8#306 /AE 8#307 /Ccedilla 8#310 /Egrave 8#311 /Eacute -8#312 /Ecircumflex 8#313 /Edieresis 8#314 /Igrave 8#315 /Iacute -8#316 /Icircumflex 8#317 /Idieresis 8#320 /Eth 8#321 /Ntilde 8#322 /Ograve -8#323 /Oacute 8#324 /Ocircumflex 8#325 /Otilde 8#326 /Odieresis 8#327 /multiply -8#330 /Oslash 8#331 /Ugrave 8#332 /Uacute 8#333 /Ucircumflex -8#334 /Udieresis 8#335 /Yacute 8#336 /Thorn 8#337 /germandbls 8#340 /agrave -8#341 /aacute 8#342 /acircumflex 8#343 /atilde 8#344 /adieresis 8#345 /aring -8#346 /ae 8#347 /ccedilla 8#350 /egrave 8#351 /eacute -8#352 /ecircumflex 8#353 /edieresis 8#354 /igrave 8#355 /iacute -8#356 /icircumflex 8#357 /idieresis 8#360 /eth 8#361 /ntilde 8#362 /ograve -8#363 /oacute 8#364 /ocircumflex 8#365 /otilde 8#366 /odieresis 8#367 /divide -8#370 /oslash 8#371 /ugrave 8#372 /uacute 8#373 /ucircumflex -8#374 /udieresis 8#375 /yacute 8#376 /thorn 8#377 /ydieresis] def -/Helvetica-Bold /Helvetica-Bold-iso isovec ReEncode -/Helvetica /Helvetica-iso isovec ReEncode -/Helvetica-Oblique /Helvetica-Oblique-iso isovec ReEncode - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 5962 m -1000 -1000 l 7537 -1000 l 7537 5962 l cp clip - 0.05039 0.05039 sc -% Polyline -7.500 slw -n 1770 2700 m 1665 2700 1665 3045 105 arcto 4 {pop} repeat - 1665 3150 2730 3150 105 arcto 4 {pop} repeat - 2835 3150 2835 2805 105 arcto 4 {pop} repeat - 2835 2700 1770 2700 105 arcto 4 {pop} repeat - cp gs col7 0.75 shd ef gr gs col0 s gr -% Ellipse -n 2250 1125 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1575 2025 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2925 2025 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 900 2925 242 242 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Polyline -n 420 3825 m 315 3825 315 4170 105 arcto 4 {pop} repeat - 315 4275 1380 4275 105 arcto 4 {pop} repeat - 1485 4275 1485 3930 105 arcto 4 {pop} repeat - 1485 3825 420 3825 105 arcto 4 {pop} repeat - cp gs col7 0.75 shd ef gr gs col0 s gr -% Polyline -n 2085 1275 m 1582 1807 l gs col0 s gr -% Polyline -n 2407 1297 m 2940 1800 l gs col0 s gr -% Polyline -n 1417 2190 m 900 2692 l gs col0 s gr -% Polyline -n 1740 2190 m 2257 2700 l gs col0 s gr -% Polyline -n 892 3180 m 892 3825 l gs col0 s gr -% Polyline -n 45 675 m 6525 675 l 6525 4950 l 45 4950 l cp gs col0 s gr -% Polyline -n 2250 3600 m 2263 3597 l 2277 3594 l 2293 3592 l 2309 3589 l 2326 3586 l - 2344 3583 l 2362 3580 l 2381 3578 l 2399 3575 l 2418 3572 l - 2436 3569 l 2454 3566 l 2471 3563 l 2488 3561 l 2504 3558 l - 2520 3555 l 2537 3552 l 2555 3548 l 2571 3545 l 2588 3541 l - 2604 3537 l 2621 3533 l 2637 3528 l 2653 3524 l 2669 3520 l - 2684 3517 l 2700 3514 l 2715 3512 l 2730 3510 l 2745 3510 l - 2762 3511 l 2777 3512 l 2793 3514 l 2807 3517 l 2821 3520 l - 2835 3524 l 2849 3528 l 2863 3532 l 2877 3537 l 2893 3542 l - 2908 3548 l 2925 3555 l 2938 3561 l 2951 3568 l 2965 3575 l - 2978 3584 l 2992 3593 l 3007 3602 l 3021 3612 l 3035 3623 l - 3050 3633 l 3064 3643 l 3079 3652 l 3093 3661 l 3108 3670 l - 3122 3677 l 3136 3684 l 3150 3690 l 3166 3696 l 3182 3701 l - 3198 3706 l 3214 3710 l 3230 3713 l 3246 3716 l 3263 3719 l - 3279 3721 l 3295 3724 l 3311 3726 l 3327 3729 l 3343 3731 l - 3359 3733 l 3375 3735 l 3391 3736 l 3407 3737 l 3423 3738 l - 3439 3738 l 3455 3738 l 3471 3738 l 3488 3737 l 3504 3737 l - 3520 3736 l 3536 3736 l 3552 3735 l 3568 3735 l 3584 3735 l - 3600 3735 l 3616 3735 l 3632 3735 l 3648 3734 l 3663 3734 l - 3678 3733 l 3693 3732 l 3708 3731 l 3723 3730 l 3739 3729 l - 3755 3729 l 3771 3729 l 3788 3730 l 3806 3732 l 3825 3735 l - 3840 3738 l 3856 3741 l 3874 3745 l 3892 3749 l 3911 3753 l - 3931 3757 l 3951 3762 l 3972 3767 l 3993 3772 l 4014 3777 l - 4034 3782 l 4054 3787 l 4072 3793 l 4089 3799 l 4105 3805 l - 4119 3811 l 4130 3818 l 4140 3825 l 4150 3835 l 4157 3846 l - 4161 3858 l 4163 3870 l 4164 3883 l 4163 3897 l 4161 3911 l - 4159 3925 l 4156 3939 l 4154 3952 l 4151 3966 l 4148 3979 l - 4144 3992 l 4140 4005 l 4135 4018 l 4128 4031 l 4121 4045 l - 4112 4058 l 4104 4073 l 4095 4087 l 4085 4101 l 4075 4116 l - 4065 4129 l 4055 4143 l 4043 4155 l 4032 4166 l 4019 4176 l - 4005 4185 l 3992 4192 l 3978 4197 l 3963 4202 l 3947 4206 l - 3930 4210 l 3913 4213 l 3896 4216 l 3878 4218 l 3861 4220 l - 3843 4222 l 3825 4224 l 3807 4226 l 3789 4228 l 3771 4229 l - 3753 4230 l 3735 4230 l 3717 4230 l 3698 4228 l 3678 4226 l - 3659 4224 l 3639 4220 l 3619 4216 l 3598 4212 l 3578 4208 l - 3557 4203 l 3536 4199 l 3516 4195 l 3496 4191 l 3477 4189 l - 3457 4187 l 3438 4185 l 3420 4185 l 3402 4185 l 3384 4186 l - 3367 4188 l 3350 4190 l 3333 4193 l 3317 4196 l 3301 4200 l - 3285 4203 l 3269 4207 l 3253 4211 l 3237 4214 l 3220 4218 l - 3203 4221 l 3186 4224 l 3168 4227 l 3150 4230 l 3132 4233 l - 3113 4236 l 3094 4239 l 3074 4242 l 3055 4246 l 3035 4249 l - 3015 4253 l 2995 4257 l 2974 4260 l 2954 4264 l 2934 4267 l - 2914 4270 l 2894 4272 l 2874 4274 l 2855 4275 l 2835 4275 l - 2815 4275 l 2795 4274 l 2775 4272 l 2755 4270 l 2734 4268 l - 2713 4265 l 2692 4262 l 2671 4259 l 2650 4256 l 2630 4252 l - 2609 4249 l 2590 4245 l 2571 4242 l 2553 4238 l 2536 4234 l - 2520 4230 l 2503 4225 l 2487 4219 l 2473 4213 l 2460 4207 l - 2448 4200 l 2437 4192 l 2426 4185 l 2415 4178 l 2404 4170 l - 2393 4163 l 2380 4157 l 2368 4151 l 2354 4145 l 2340 4140 l - 2325 4135 l 2310 4131 l 2294 4128 l 2277 4125 l 2260 4122 l - 2243 4120 l 2225 4118 l 2208 4115 l 2191 4113 l 2174 4110 l - 2158 4107 l 2143 4104 l 2128 4100 l 2115 4095 l 2101 4089 l - 2087 4083 l 2074 4076 l 2061 4070 l 2049 4063 l 2037 4056 l - 2025 4049 l 2014 4042 l 2004 4034 l 1995 4025 l 1987 4016 l - 1980 4005 l 1975 3993 l 1972 3980 l 1971 3965 l 1970 3949 l - 1971 3932 l 1972 3915 l 1973 3898 l 1974 3881 l 1976 3865 l - 1977 3850 l 1978 3837 l 1980 3825 l 1983 3812 l 1986 3801 l - 1990 3792 l 1994 3784 l 1998 3776 l 2003 3768 l 2008 3761 l - 2013 3752 l 2019 3744 l 2025 3735 l 2032 3726 l 2040 3717 l - 2048 3707 l 2057 3698 l 2066 3688 l 2075 3678 l 2084 3669 l - 2094 3660 l 2104 3652 l 2115 3645 l 2127 3639 l 2138 3633 l - 2150 3628 l 2162 3624 l 2174 3620 l 2186 3617 l 2200 3613 l - 2214 3609 l 2231 3604 l cp gs col0 s gr -% Polyline -n 3645 1080 m 3660 1077 l 3677 1074 l 3694 1071 l 3713 1068 l 3733 1065 l - 3754 1063 l 3775 1060 l 3798 1058 l 3820 1056 l 3843 1053 l - 3866 1051 l 3889 1049 l 3912 1047 l 3934 1045 l 3955 1043 l - 3976 1041 l 3996 1039 l 4015 1038 l 4033 1036 l 4050 1035 l - 4071 1034 l 4090 1033 l 4109 1032 l 4127 1032 l 4144 1031 l - 4161 1031 l 4177 1031 l 4193 1031 l 4209 1031 l 4225 1031 l - 4241 1031 l 4257 1032 l 4273 1032 l 4289 1033 l 4304 1034 l - 4320 1035 l 4337 1037 l 4354 1039 l 4371 1041 l 4387 1044 l - 4403 1047 l 4419 1050 l 4435 1053 l 4450 1057 l 4466 1060 l - 4481 1063 l 4497 1067 l 4513 1071 l 4529 1075 l 4545 1080 l - 4561 1085 l 4577 1091 l 4592 1097 l 4607 1103 l 4622 1110 l - 4637 1118 l 4651 1125 l 4666 1132 l 4681 1140 l 4697 1147 l - 4713 1153 l 4731 1159 l 4750 1165 l 4770 1170 l 4787 1174 l - 4804 1177 l 4823 1180 l 4842 1182 l 4863 1184 l 4884 1186 l - 4906 1188 l 4928 1189 l 4950 1190 l 4972 1192 l 4994 1193 l - 5016 1195 l 5037 1197 l 5058 1200 l 5077 1203 l 5096 1206 l - 5113 1210 l 5130 1215 l 5148 1221 l 5165 1228 l 5181 1235 l - 5197 1242 l 5212 1250 l 5228 1259 l 5243 1267 l 5257 1276 l - 5272 1285 l 5286 1294 l 5299 1303 l 5312 1312 l 5324 1322 l - 5336 1331 l 5346 1340 l 5355 1350 l 5365 1363 l 5373 1378 l - 5380 1392 l 5386 1408 l 5390 1424 l 5394 1440 l 5398 1456 l - 5401 1472 l 5402 1488 l 5403 1502 l 5403 1517 l 5400 1530 l - 5395 1543 l 5389 1555 l 5381 1568 l 5372 1580 l 5363 1592 l - 5354 1604 l 5343 1616 l 5331 1627 l 5318 1638 l 5303 1648 l - 5286 1657 l 5265 1665 l 5251 1669 l 5235 1673 l 5219 1677 l - 5201 1680 l 5182 1683 l 5162 1685 l 5141 1688 l 5119 1690 l - 5097 1692 l 5075 1694 l 5053 1696 l 5030 1697 l 5008 1699 l - 4986 1701 l 4964 1703 l 4943 1704 l 4921 1706 l 4901 1707 l - 4880 1709 l 4860 1710 l 4840 1711 l 4819 1712 l 4799 1713 l - 4779 1713 l 4758 1713 l 4738 1714 l 4717 1714 l 4697 1714 l - 4676 1714 l 4655 1714 l 4635 1714 l 4614 1714 l 4594 1714 l - 4573 1714 l 4553 1713 l 4533 1713 l 4513 1713 l 4494 1712 l - 4474 1711 l 4455 1710 l 4434 1709 l 4413 1707 l 4392 1705 l - 4372 1703 l 4351 1701 l 4331 1698 l 4311 1695 l 4291 1692 l - 4271 1690 l 4251 1687 l 4231 1684 l 4211 1681 l 4191 1678 l - 4172 1675 l 4152 1673 l 4133 1670 l 4114 1668 l 4095 1665 l - 4074 1662 l 4053 1659 l 4033 1657 l 4012 1654 l 3992 1651 l - 3972 1648 l 3951 1645 l 3931 1643 l 3911 1640 l 3891 1637 l - 3872 1634 l 3852 1631 l 3833 1628 l 3815 1626 l 3797 1623 l - 3780 1620 l 3761 1617 l 3743 1614 l 3725 1611 l 3708 1608 l - 3692 1605 l 3675 1602 l 3659 1600 l 3643 1597 l 3627 1594 l - 3612 1591 l 3597 1587 l 3582 1584 l 3568 1580 l 3555 1575 l - 3541 1569 l 3527 1563 l 3514 1556 l 3501 1550 l 3489 1543 l - 3477 1536 l 3465 1529 l 3454 1522 l 3444 1514 l 3435 1505 l - 3427 1496 l 3420 1485 l 3415 1473 l 3412 1460 l 3411 1445 l - 3410 1430 l 3411 1414 l 3412 1397 l 3413 1380 l 3414 1364 l - 3416 1348 l 3417 1333 l 3418 1318 l 3420 1305 l 3423 1290 l - 3425 1275 l 3428 1261 l 3431 1247 l 3434 1233 l 3437 1220 l - 3442 1207 l 3447 1194 l 3455 1182 l 3465 1170 l 3474 1162 l - 3483 1155 l 3493 1148 l 3504 1141 l 3515 1134 l 3526 1127 l - 3538 1121 l 3550 1114 l 3563 1108 l 3577 1102 l 3591 1096 l - 3607 1090 l 3625 1085 l cp gs col0 s gr -% Polyline -n 2475 1215 m 2477 1217 l 2482 1221 l 2491 1229 l 2503 1239 l 2517 1252 l - 2534 1267 l 2552 1282 l 2570 1296 l 2588 1310 l 2605 1322 l - 2621 1332 l 2638 1342 l 2655 1350 l 2669 1356 l 2684 1362 l - 2700 1368 l 2717 1374 l 2734 1380 l 2752 1386 l 2770 1392 l - 2789 1398 l 2808 1403 l 2827 1409 l 2846 1415 l 2865 1420 l - 2884 1425 l 2902 1429 l 2920 1433 l 2937 1436 l 2954 1438 l - 2970 1440 l 2988 1441 l 3006 1441 l 3024 1440 l 3041 1439 l - 3059 1437 l 3076 1434 l 3094 1431 l 3111 1428 l 3129 1425 l - 3146 1421 l 3162 1417 l 3179 1414 l 3195 1409 l 3211 1405 l - 3226 1400 l 3240 1395 l 3256 1388 l 3271 1380 l 3287 1370 l - 3304 1358 l 3322 1344 l 3340 1329 l 3359 1314 l 3376 1299 l - 3391 1286 l 3404 1275 l 3412 1267 l 3418 1262 l 3420 1260 l gs col0 s gr -% Polyline -n 1125 3060 m 1126 3063 l 1127 3068 l 1129 3078 l 1132 3093 l 1136 3112 l - 1141 3135 l 1146 3162 l 1153 3190 l 1159 3219 l 1166 3248 l - 1173 3275 l 1180 3301 l 1187 3324 l 1193 3345 l 1200 3364 l - 1207 3381 l 1215 3397 l 1224 3414 l 1234 3429 l 1245 3444 l - 1256 3459 l 1267 3473 l 1279 3486 l 1291 3499 l 1304 3512 l - 1316 3525 l 1329 3537 l 1342 3550 l 1355 3562 l 1368 3574 l - 1382 3585 l 1396 3596 l 1410 3607 l 1425 3617 l 1441 3626 l - 1457 3635 l 1473 3644 l 1490 3653 l 1507 3661 l 1524 3669 l - 1542 3677 l 1559 3685 l 1577 3692 l 1595 3700 l 1613 3706 l - 1631 3713 l 1649 3718 l 1668 3723 l 1687 3727 l 1704 3730 l - 1723 3732 l 1743 3733 l 1764 3734 l 1788 3734 l 1814 3733 l - 1841 3732 l 1869 3731 l 1898 3729 l 1926 3727 l 1952 3725 l - 1975 3724 l 1993 3722 l 2008 3721 l 2017 3721 l 2022 3720 l - 2025 3720 l gs col0 s gr -/Helvetica-iso ff 180.00 scf sf -3600 1260 m -gs 1 -1 sc (attributes:) col0 sh gr -/Helvetica-iso ff 180.00 scf sf -3600 1485 m -gs 1 -1 sc ("att" -> Value "apple") col0 sh gr -/Helvetica-iso ff 180.00 scf sf -2250 3780 m -gs 1 -1 sc (attributes:) col0 sh gr -/Helvetica-Oblique-iso ff 180.00 scf sf -390 4725 m -gs 1 -1 sc (An orangeCherries) col0 sh gr -/Helvetica-iso ff 180.00 scf sf -2250 4005 m -gs 1 -1 sc ("att" -> Value "orange") col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -1815 3015 m -gs 1 -1 sc ("Cherries") col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -375 4125 m -gs 1 -1 sc ("An orange") col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -750 2985 m -gs 1 -1 sc () col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -1410 2085 m -gs 1 -1 sc () col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -2790 2070 m -gs 1 -1 sc () col0 sh gr -/Helvetica-Bold-iso ff 180.00 scf sf -2100 1200 m -gs 1 -1 sc () col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 2578 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 2578 a 357 x Fv(Only)g(elements,)g(data)g -(sections,)g(attrib)n(utes)g(and)g(processing)e(instructions)i(\(and)f -(comments,)g(if)h(con\002gured\))e(can,)396 3043 y(directly)i(or)g -(indirectly)-5 b(,)18 b(occur)h(in)h(the)h(document)d(tree.)i(It)g(is)h -(impossible)f(to)g(add)g(entity)g(references)f(to)h(the)g(tree;)g(if) -396 3151 y(the)g(parser)g(\002nds)g(such)g(a)h(reference,)d(not)i(the)g -(reference)f(as)i(such)f(b)n(ut)g(the)g(referenced)e(te)o(xt)i(\(i.e.)g -(the)g(tree)396 3259 y(representing)e(the)j(structured)d(te)o(xt\))i -(is)h(included)e(in)h(the)g(tree.)396 3409 y(Note)g(that)h(the)f -(parser)f(collapses)i(as)g(much)e(data)h(material)g(into)g(one)f(data)h -(node)f(as)i(possible)f(such)g(that)g(there)g(are)396 -3517 y(normally)f(ne)n(v)o(er)g(tw)o(o)h(adjacent)f(data)i(nodes.)e -(This)h(in)m(v)n(ariant)f(is)i(enforced)d(e)n(v)o(en)h(if)i(data)f -(material)f(is)j(included)c(by)396 3625 y(entity)i(references)f(or)h -(CD)m(A)-9 b(T)h(A)20 b(sections,)g(or)g(if)h(a)f(data)g(sequence)f(is) -j(interrupted)c(by)h(comments.)g(So)i Fq(a)44 b(&)g(b)396 -3732 y Fo(<)p Fq(-)h(comment)e(-)p Fo(>)i Fq(c)f Fo(<)p -Fq(![CDATA[)g Fo(<>)g Fq(d]])p Fo(>)20 b Fv(is)h(represented)d(by)i -(only)g(one)f(data)h(node,)f(for)h(instance.)396 3840 -y(Ho)n(we)n(v)o(er)m(,)e(you)i(can)g(create)g(document)e(trees)i -(manually)f(which)h(break)f(this)i(in)m(v)n(ariant;)d(it)j(is)g(only)f -(the)g(w)o(ay)g(the)396 3948 y(parser)g(forms)f(the)h(tree.)p -Black 3800 5278 a Fr(50)p Black eop -%%Page: 51 51 -51 50 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(Figur)o(e)g(3-2.)f -(Nodes)h(ar)o(e)g(doubly)g(link)o(ed)i(tr)o(ees)396 1537 -y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 1537 a @beginspecial 0 @llx 0 @lly 138 @urx 93 -@ury 1380 @rwi @setspecial -%%BeginDocument: pic/node_general.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/node_general.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 138 93 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --22.0 126.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 3487 m -1000 -1000 l 4162 -1000 l 4162 3487 l cp clip - 0.05039 0.05039 sc -7.500 slw -% Ellipse -n 2025 2025 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1350 2025 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2700 2025 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2025 1125 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Polyline -gs clippath -1743 1345 m 1845 1275 l 1788 1385 l 1877 1284 l 1832 1244 l cp -clip -n 1380 1800 m 1845 1275 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1743 1345 m 1845 1275 l 1788 1385 l 1765 1365 l 1743 1345 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -1384 1745 m 1282 1815 l 1339 1705 l 1250 1807 l 1295 1846 l cp -clip -n 1815 1207 m 1282 1815 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1384 1745 m 1282 1815 l 1339 1705 l 1361 1725 l 1384 1745 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2025 1470 m 2055 1350 l 2085 1470 l 2085 1335 l 2025 1335 l cp -clip -n 2055 1792 m 2055 1350 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2025 1470 m 2055 1350 l 2085 1470 l 2055 1470 l 2025 1470 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2010 1687 m 1980 1807 l 1950 1687 l 1950 1822 l 2010 1822 l cp -clip -n 1980 1350 m 1980 1807 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2010 1687 m 1980 1807 l 1950 1687 l 1980 1687 l 2010 1687 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2511 1750 m 2550 1867 l 2461 1782 l 2533 1896 l 2583 1864 l cp -clip -n 2190 1297 m 2550 1867 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2511 1750 m 2550 1867 l 2461 1782 l 2486 1766 l 2511 1750 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2262 1353 m 2220 1237 l 2312 1320 l 2237 1208 l 2187 1241 l cp -clip -n 2602 1807 m 2220 1237 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2262 1353 m 2220 1237 l 2312 1320 l 2287 1337 l 2262 1353 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -n 450 675 m 3150 675 l 3150 2475 l 450 2475 l cp gs col0 s gr -/Courier ff 150.00 scf sf -2377 1342 m -gs 1 -1 sc (parent) col0 sh gr -/Courier ff 150.00 scf sf -645 1628 m -gs 1 -1 sc (sub_nodes) col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 1537 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 1537 a 357 x Fv(The)e(node)f(tree)h(has)h -(links)f(in)g(both)g(directions:)f(Ev)o(ery)g(node)g(has)h(a)h(link)f -(to)g(its)i(parent)d(\(if)h(an)o(y\),)f(and)g(it)i(has)g(links)f(to)396 -2002 y(the)g(subnodes)f(\(see)i(\002gure)e Fr(Nodes)h(ar)m(e)h(doubly)d -(link)o(ed)i(tr)m(ees)p Fv(\).)h(Ob)o(viously)-5 b(,)18 -b(this)i(doubly-link)o(ed)d(structure)396 2110 y(simpli\002es)k(the)f -(na)n(vigation)e(in)j(the)f(tree;)g(b)n(ut)g(has)h(also)f(some)g -(consequences)f(for)g(the)h(possible)g(operations)f(on)h(trees.)396 -2259 y(Because)h(e)n(v)o(ery)d(node)i(must)g(ha)n(v)o(e)f(at)i(most)f -Fr(one)g Fv(parent)f(node,)g(operations)g(are)h(ille)o(gal)g(if)g(the)o -(y)f(violate)h(this)396 2367 y(condition.)e(The)i(follo)n(wing)f -(\002gure)g(\()p Fr(A)h(node)g(can)f(only)h(be)g(added)f(if)i(it)g(is)g -(a)f(r)l(oot)q Fv(\))g(sho)n(ws)h(on)e(the)i(left)f(side)h(that)f(node) -396 2475 y Fq(y)h Fv(is)g(added)e(to)h Fq(x)h Fv(as)g(ne)n(w)f(subnode) -e(which)i(is)h(allo)n(wed)f(because)f Fq(y)i Fv(does)f(not)g(ha)n(v)o -(e)f(a)i(parent)e(yet.)h(The)g(right)f(side)i(of)396 -2583 y(the)f(picture)g(illustrates)g(what)h(w)o(ould)e(happen)g(if)h -Fq(y)h Fv(had)e(a)i(parent)e(node;)g(this)i(is)g(ille)o(gal)f(because)f -Fq(y)i Fv(w)o(ould)e(ha)n(v)o(e)h(tw)o(o)396 2691 y(parents)g(after)g -(the)g(operation.)396 2923 y Fu(Figur)o(e)g(3-3.)f(A)i(node)f(can)g -(only)g(be)h(added)g(if)f(it)h(is)g(a)f(r)o(oot)396 4165 -y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 4165 a @beginspecial 0 @llx 0 @lly 422 @urx 127 -@ury 4220 @rwi @setspecial -%%BeginDocument: pic/node_add.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/node_add.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 422 127 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --33.0 171.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 4387 m -1000 -1000 l 10012 -1000 l 10012 4387 l cp clip - 0.05039 0.05039 sc -7.500 slw -% Ellipse -n 6141 1350 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 6141 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 5426 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 6856 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 7571 2925 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 8524 2925 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 8047 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1866 1350 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1866 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1151 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2581 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 3296 2925 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 4249 2925 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 3772 2250 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 8325 1350 242 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Polyline -gs clippath -5507 1945 m 5402 2017 l 5460 1904 l 5369 2008 l 5415 2049 l cp -clip -n 5910 1440 m 5402 2017 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 5507 1945 m 5402 2017 l 5460 1904 l 5484 1924 l 5507 1945 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6134 1902 m 6101 2025 l 6072 1901 l 6070 2039 l 6132 2041 l cp -clip -n 6109 1590 m 6101 2025 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 6134 1902 m 6101 2025 l 6072 1901 l 6103 1901 l 6134 1902 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6649 1952 m 6697 2070 l 6599 1989 l 6681 2100 l 6731 2064 l cp -clip -n 6307 1537 m 6697 2070 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 6649 1952 m 6697 2070 l 6599 1989 l 6624 1970 l 6649 1952 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7696 2606 m 7602 2692 l 7645 2572 l 7568 2687 l 7619 2722 l cp -clip -n 7832 2347 m 7602 2692 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 7696 2606 m 7602 2692 l 7645 2572 l 7671 2589 l 7696 2606 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8306 2632 m 8349 2752 l 8255 2666 l 8332 2782 l 8383 2747 l cp -clip -n 8150 2452 m 8349 2752 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 8306 2632 m 8349 2752 l 8255 2666 l 8281 2649 l 8306 2632 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -5853 1564 m 5958 1492 l 5899 1605 l 5991 1501 l 5945 1460 l cp -clip -n 5490 2017 m 5958 1492 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 5853 1564 m 5958 1492 l 5899 1605 l 5876 1584 l 5853 1564 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6140 1698 m 6173 1575 l 6201 1699 l 6204 1561 l 6142 1559 l cp -clip -n 6164 2010 m 6173 1575 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 6140 1698 m 6173 1575 l 6201 1699 l 6170 1699 l 6140 1698 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6404 1588 m 6355 1470 l 6454 1551 l 6371 1440 l 6321 1476 l cp -clip -n 6768 2025 m 6355 1470 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 6404 1588 m 6355 1470 l 6454 1551 l 6429 1569 l 6404 1588 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -7784 2499 m 7880 2415 l 7835 2534 l 7914 2420 l 7863 2385 l cp -clip -n 7673 2715 m 7880 2415 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 7784 2499 m 7880 2415 l 7835 2534 l 7810 2517 l 7784 2499 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -8263 2535 m 8222 2415 l 8315 2502 l 8240 2386 l 8188 2419 l cp -clip -n 8412 2707 m 8222 2415 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 8263 2535 m 8222 2415 l 8315 2502 l 8289 2519 l 8263 2535 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -1232 1945 m 1127 2017 l 1185 1904 l 1094 2008 l 1140 2049 l cp -clip -n 1635 1440 m 1127 2017 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1232 1945 m 1127 2017 l 1185 1904 l 1209 1924 l 1232 1945 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -1859 1902 m 1826 2025 l 1797 1901 l 1795 2039 l 1857 2041 l cp -clip -n 1834 1590 m 1826 2025 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1859 1902 m 1826 2025 l 1797 1901 l 1828 1902 l 1859 1902 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2374 1952 m 2422 2070 l 2324 1989 l 2406 2100 l 2456 2064 l cp -clip -n 2032 1537 m 2422 2070 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2374 1952 m 2422 2070 l 2324 1989 l 2349 1970 l 2374 1952 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -3421 2606 m 3327 2692 l 3370 2572 l 3293 2687 l 3344 2722 l cp -clip -n 3557 2347 m 3327 2692 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 3421 2606 m 3327 2692 l 3370 2572 l 3396 2589 l 3421 2606 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -4031 2632 m 4074 2752 l 3980 2666 l 4057 2782 l 4108 2747 l cp -clip -n 3875 2452 m 4074 2752 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 4031 2632 m 4074 2752 l 3980 2666 l 4006 2649 l 4031 2632 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -1578 1564 m 1683 1492 l 1624 1605 l 1716 1501 l 1670 1460 l cp -clip -n 1215 2017 m 1683 1492 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1578 1564 m 1683 1492 l 1624 1605 l 1601 1584 l 1578 1564 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -1865 1698 m 1898 1575 l 1926 1699 l 1929 1561 l 1867 1559 l cp -clip -n 1889 2010 m 1898 1575 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 1865 1698 m 1898 1575 l 1926 1699 l 1895 1698 l 1865 1698 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2129 1588 m 2080 1470 l 2179 1551 l 2096 1440 l 2046 1476 l cp -clip -n 2493 2025 m 2080 1470 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 2129 1588 m 2080 1470 l 2179 1551 l 2154 1569 l 2129 1588 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -3509 2499 m 3605 2415 l 3560 2534 l 3639 2420 l 3588 2385 l cp -clip -n 3398 2715 m 3605 2415 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 3509 2499 m 3605 2415 l 3560 2534 l 3535 2517 l 3509 2499 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -3988 2535 m 3947 2415 l 4040 2502 l 3965 2386 l 3913 2419 l cp -clip -n 4137 2707 m 3947 2415 l gs col7 0.75 shd ef gr gs col0 s gr gr - -% arrowhead -n 3988 2535 m 3947 2415 l 4040 2502 l 4014 2519 l 3988 2535 l cp gs col7 1.00 shd ef gr col0 s -% Polyline - [60] 0 sd -n 6387 1372 m 8023 2017 l gs col7 0.75 shd ef gr gs col0 s gr [] 0 sd -% Polyline -n 4950 900 m 9000 900 l 9000 3375 l 4950 3375 l cp gs col0 s gr -% Polyline - [60] 0 sd -n 2112 1372 m 3748 2017 l gs col7 0.75 shd ef gr gs col0 s gr [] 0 sd -% Polyline -n 675 900 m 4725 900 l 4725 3375 l 675 3375 l cp gs col0 s gr -% Polyline -gs clippath -8119 1904 m 8055 2010 l 8061 1886 l 8022 2016 l 8079 2033 l cp -clip -n 8197 1545 m 8055 2010 l gs col0 s gr gr - -% arrowhead -n 8119 1904 m 8055 2010 l 8061 1886 l 8090 1895 l 8119 1904 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8214 1695 m 8280 1590 l 8271 1713 l 8313 1585 l 8256 1566 l cp -clip -n 8137 2025 m 8280 1590 l gs col0 s gr gr - -% arrowhead -n 8214 1695 m 8280 1590 l 8271 1713 l 8243 1704 l 8214 1695 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -30.000 slw -gs clippath -7687 2205 m 7502 2333 l 7594 2129 l 7410 2351 l 7503 2428 l cp -clip -n 7875 1500 m 7620 1965 l 7845 1920 l 7485 2355 l gs col0 s gr gr - -% arrowhead -15.000 slw -n 7687 2205 m 7502 2333 l 7594 2129 l 7618 2195 l 7687 2205 l cp gs 0.00 setgray ef gr col0 s -/Courier-Bold ff 195.00 scf sf -6094 1379 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 195.00 scf sf -7991 2265 m -gs 1 -1 sc (y) col0 sh gr -/Courier-Bold ff 195.00 scf sf -1819 1379 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 195.00 scf sf -3716 2265 m -gs 1 -1 sc (y) col0 sh gr -/Courier ff 180.00 scf sf -6459 1335 m -gs 1 -1 sc (x # add_node y) col0 sh gr -/Courier ff 180.00 scf sf -2214 1365 m -gs 1 -1 sc (x # add_node y) col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 4165 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 4165 a 357 x Fv(The)g("delete")g(operation) -e(simply)i(remo)o(v)o(es)f(the)h(links)g(between)f(tw)o(o)i(nodes.)e -(In)h(the)g(picture)f(\()p Fr(A)i(deleted)e(node)396 -4629 y(becomes)h(the)g(r)l(oot)g(of)h(the)f(subtr)m(ee)p -Fv(\))g(the)g(node)f Fq(x)i Fv(is)g(deleted)e(from)h(the)g(list)h(of)f -(subnodes)f(of)h Fq(y)p Fv(.)g(After)g(that,)g Fq(x)396 -4737 y Fv(becomes)g(the)g(root)f(of)h(the)g(subtree)g(starting)g(at)g -(this)h(node.)p Black 3800 5278 a Fr(51)p Black eop -%%Page: 52 52 -52 51 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(Figur)o(e)g(3-4.)f(A)i -(deleted)f(node)g(becomes)h(the)f(r)o(oot)f(of)h(the)g(subtr)o(ee)396 -1912 y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 1912 a @beginspecial 0 @llx 0 @lly 388 @urx -138 @ury 3880 @rwi @setspecial -%%BeginDocument: pic/node_delete.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/node_delete.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 388 138 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --78.0 205.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 5062 m -1000 -1000 l 10237 -1000 l 10237 5062 l cp clip - 0.05039 0.05039 sc -7.500 slw -% Ellipse -n 2700 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 2250 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 3150 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Polyline -gs clippath -2322 3272 m 2235 3360 l 2271 3242 l 2202 3358 l 2253 3388 l cp -clip -n 2535 2857 m 2235 3360 l gs col0 s gr gr - -% arrowhead -n 2322 3272 m 2235 3360 l 2271 3242 l 2296 3257 l 2322 3272 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2978 3298 m 3000 3420 l 2924 3323 l 2979 3446 l 3034 3421 l cp -clip -n 2782 2932 m 3000 3420 l gs col0 s gr gr - -% arrowhead -n 2978 3298 m 3000 3420 l 2924 3323 l 2951 3310 l 2978 3298 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2500 2998 m 2587 2910 l 2552 3029 l 2620 2912 l 2569 2882 l cp -clip -n 2317 3367 m 2587 2910 l gs col0 s gr gr - -% arrowhead -n 2500 2998 m 2587 2910 l 2552 3029 l 2526 3013 l 2500 2998 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2864 3009 m 2842 2887 l 2918 2984 l 2863 2861 l 2808 2886 l cp -clip -n 3060 3375 m 2842 2887 l gs col0 s gr gr - -% arrowhead -n 2864 3009 m 2842 2887 l 2918 2984 l 2891 2997 l 2864 3009 l cp gs col7 1.00 shd ef gr col0 s -% Ellipse -n 2700 1800 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2025 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 3375 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 6345 1800 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 5670 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 7020 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 8325 1800 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 7875 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 8775 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Polyline -gs clippath -2707 2152 m 2737 2032 l 2767 2152 l 2767 2017 l 2707 2017 l cp -clip -n 2737 2460 m 2737 2032 l gs col0 s gr gr - -% arrowhead -n 2707 2152 m 2737 2032 l 2767 2152 l 2737 2152 l 2707 2152 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2692 2347 m 2662 2467 l 2632 2347 l 2632 2482 l 2692 2482 l cp -clip -n 2662 2032 m 2662 2467 l gs col0 s gr gr - -% arrowhead -n 2692 2347 m 2662 2467 l 2632 2347 l 2662 2347 l 2692 2347 l cp gs 0.00 setgray ef gr col0 s -% Polyline -1 slj -60.000 slw -n 4050 2610 m 4725 2610 l gs col0 s gr -% Polyline -n 4050 2745 m 4725 2745 l gs col0 s gr -% Polyline -1 slc -n 4500 2385 m 4950 2655 l 4500 2970 l gs col0 s gr -% Polyline -0 slj -0 slc -7.500 slw -gs clippath -2125 2394 m 2025 2467 l 2078 2355 l 1992 2459 l 2039 2498 l cp -clip -n 2490 1905 m 2025 2467 l gs col0 s gr gr - -% arrowhead -n 2125 2394 m 2025 2467 l 2078 2355 l 2101 2375 l 2125 2394 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -3158 2426 m 3202 2542 l 3109 2461 l 3186 2571 l 3235 2537 l cp -clip -n 2827 2002 m 3202 2542 l gs col0 s gr gr - -% arrowhead -n 3158 2426 m 3202 2542 l 3109 2461 l 3134 2443 l 3158 2426 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2436 2039 m 2535 1965 l 2482 2077 l 2568 1972 l 2521 1934 l cp -clip -n 2115 2475 m 2535 1965 l gs col0 s gr gr - -% arrowhead -n 2436 2039 m 2535 1965 l 2482 2077 l 2459 2058 l 2436 2039 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2916 2073 m 2872 1957 l 2965 2038 l 2888 1928 l 2839 1962 l cp -clip -n 3255 2505 m 2872 1957 l gs col0 s gr gr - -% arrowhead -n 2916 2073 m 2872 1957 l 2965 2038 l 2941 2055 l 2916 2073 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -5770 2394 m 5670 2467 l 5723 2355 l 5637 2459 l 5684 2498 l cp -clip -n 6135 1905 m 5670 2467 l gs col0 s gr gr - -% arrowhead -n 5770 2394 m 5670 2467 l 5723 2355 l 5746 2375 l 5770 2394 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6803 2426 m 6847 2542 l 6754 2461 l 6831 2571 l 6880 2537 l cp -clip -n 6472 2002 m 6847 2542 l gs col0 s gr gr - -% arrowhead -n 6803 2426 m 6847 2542 l 6754 2461 l 6779 2443 l 6803 2426 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6081 2039 m 6180 1965 l 6127 2077 l 6213 1972 l 6166 1934 l cp -clip -n 5760 2475 m 6180 1965 l gs col0 s gr gr - -% arrowhead -n 6081 2039 m 6180 1965 l 6127 2077 l 6104 2058 l 6081 2039 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6561 2073 m 6517 1957 l 6610 2038 l 6533 1928 l 6484 1962 l cp -clip -n 6900 2505 m 6517 1957 l gs col0 s gr gr - -% arrowhead -n 6561 2073 m 6517 1957 l 6610 2038 l 6586 2055 l 6561 2073 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -7947 2372 m 7860 2460 l 7896 2342 l 7827 2458 l 7878 2488 l cp -clip -n 8160 1957 m 7860 2460 l gs col0 s gr gr - -% arrowhead -n 7947 2372 m 7860 2460 l 7896 2342 l 7921 2357 l 7947 2372 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8603 2398 m 8625 2520 l 8549 2423 l 8604 2546 l 8659 2521 l cp -clip -n 8407 2032 m 8625 2520 l gs col0 s gr gr - -% arrowhead -n 8603 2398 m 8625 2520 l 8549 2423 l 8576 2410 l 8603 2398 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8125 2098 m 8212 2010 l 8177 2129 l 8245 2012 l 8194 1982 l cp -clip -n 7942 2467 m 8212 2010 l gs col0 s gr gr - -% arrowhead -n 8125 2098 m 8212 2010 l 8177 2129 l 8151 2113 l 8125 2098 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -8489 2109 m 8467 1987 l 8543 2084 l 8488 1961 l 8433 1986 l cp -clip -n 8685 2475 m 8467 1987 l gs col0 s gr gr - -% arrowhead -n 8489 2109 m 8467 1987 l 8543 2084 l 8516 2097 l 8489 2109 l cp gs col7 1.00 shd ef gr col0 s -/Courier ff 180.00 scf sf -3960 2250 m -gs 1 -1 sc (x # delete) col0 sh gr -% Polyline -1 slj -1 slc -45.000 slw -n 2595 2362 m 2820 2137 l gs col0 s gr -% Polyline -n 2595 2137 m 2820 2362 l gs col0 s gr -% Polyline -0 slj -0 slc -7.500 slw -n 1575 1350 m 9225 1350 l 9225 4050 l 1575 4050 l cp gs col0 s gr -/Courier-Bold ff 180.00 scf sf -2640 2752 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 180.00 scf sf -8280 1845 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 180.00 scf sf -2655 1845 m -gs 1 -1 sc (y) col0 sh gr -/Courier-Bold ff 180.00 scf sf -6300 1845 m -gs 1 -1 sc (y) col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 1912 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 1912 a 357 x Fv(It)g(is)h(also)e(possible)h -(to)f(mak)o(e)h(a)g(clone)e(of)i(a)g(subtree;)f(illustrated)g(in)h -Fr(The)f(clone)g(of)h(a)f(subtr)m(ee)p Fv(.)h(In)f(this)h(case,)g(the)f -(clone)396 2377 y(is)i(a)g(cop)o(y)e(of)h(the)g(original)f(subtree)h(e) -o(xcept)f(that)h(it)h(is)h(no)d(longer)g(a)i(subnode.)d(Because)i -(cloning)f(ne)n(v)o(er)g(k)o(eeps)h(the)396 2485 y(connection)e(to)j -(the)f(parent,)f(the)h(clones)g(are)g(called)g Fr(orphaned)r -Fv(.)396 2717 y Fu(Figur)o(e)g(3-5.)f(The)i(clone)f(of)g(a)g(subtr)o -(ee)396 4050 y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 4050 a @beginspecial 0 @llx 0 @lly -388 @urx 138 @ury 3880 @rwi @setspecial -%%BeginDocument: pic/node_clone.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/node_clone.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 388 138 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --78.0 205.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 5062 m -1000 -1000 l 10237 -1000 l 10237 5062 l cp clip - 0.05039 0.05039 sc -7.500 slw -% Ellipse -n 2700 1800 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2025 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 3375 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 6345 1800 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 5670 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 7020 2700 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 8325 1800 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 7875 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 8775 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 6345 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 5895 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 6795 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 2700 2700 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 2250 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 3150 3600 229 229 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Polyline -1 slj -60.000 slw -n 4050 2610 m 4725 2610 l gs col0 s gr -% Polyline -n 4050 2745 m 4725 2745 l gs col0 s gr -% Polyline -1 slc -n 4500 2385 m 4950 2655 l 4500 2970 l gs col0 s gr -% Polyline -0 slj -0 slc -7.500 slw -gs clippath -2125 2394 m 2025 2467 l 2078 2355 l 1992 2459 l 2039 2498 l cp -clip -n 2490 1905 m 2025 2467 l gs col0 s gr gr - -% arrowhead -n 2125 2394 m 2025 2467 l 2078 2355 l 2101 2375 l 2125 2394 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -3158 2426 m 3202 2542 l 3109 2461 l 3186 2571 l 3235 2537 l cp -clip -n 2827 2002 m 3202 2542 l gs col0 s gr gr - -% arrowhead -n 3158 2426 m 3202 2542 l 3109 2461 l 3134 2443 l 3158 2426 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2436 2039 m 2535 1965 l 2482 2077 l 2568 1972 l 2521 1934 l cp -clip -n 2115 2475 m 2535 1965 l gs col0 s gr gr - -% arrowhead -n 2436 2039 m 2535 1965 l 2482 2077 l 2459 2058 l 2436 2039 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2916 2073 m 2872 1957 l 2965 2038 l 2888 1928 l 2839 1962 l cp -clip -n 3255 2505 m 2872 1957 l gs col0 s gr gr - -% arrowhead -n 2916 2073 m 2872 1957 l 2965 2038 l 2941 2055 l 2916 2073 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -5770 2394 m 5670 2467 l 5723 2355 l 5637 2459 l 5684 2498 l cp -clip -n 6135 1905 m 5670 2467 l gs col0 s gr gr - -% arrowhead -n 5770 2394 m 5670 2467 l 5723 2355 l 5746 2375 l 5770 2394 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6803 2426 m 6847 2542 l 6754 2461 l 6831 2571 l 6880 2537 l cp -clip -n 6472 2002 m 6847 2542 l gs col0 s gr gr - -% arrowhead -n 6803 2426 m 6847 2542 l 6754 2461 l 6779 2443 l 6803 2426 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6081 2039 m 6180 1965 l 6127 2077 l 6213 1972 l 6166 1934 l cp -clip -n 5760 2475 m 6180 1965 l gs col0 s gr gr - -% arrowhead -n 6081 2039 m 6180 1965 l 6127 2077 l 6104 2058 l 6081 2039 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6561 2073 m 6517 1957 l 6610 2038 l 6533 1928 l 6484 1962 l cp -clip -n 6900 2505 m 6517 1957 l gs col0 s gr gr - -% arrowhead -n 6561 2073 m 6517 1957 l 6610 2038 l 6586 2055 l 6561 2073 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -7947 2372 m 7860 2460 l 7896 2342 l 7827 2458 l 7878 2488 l cp -clip -n 8160 1957 m 7860 2460 l gs col0 s gr gr - -% arrowhead -n 7947 2372 m 7860 2460 l 7896 2342 l 7921 2357 l 7947 2372 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8603 2398 m 8625 2520 l 8549 2423 l 8604 2546 l 8659 2521 l cp -clip -n 8407 2032 m 8625 2520 l gs col0 s gr gr - -% arrowhead -n 8603 2398 m 8625 2520 l 8549 2423 l 8576 2410 l 8603 2398 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -8125 2098 m 8212 2010 l 8177 2129 l 8245 2012 l 8194 1982 l cp -clip -n 7942 2467 m 8212 2010 l gs col0 s gr gr - -% arrowhead -n 8125 2098 m 8212 2010 l 8177 2129 l 8151 2113 l 8125 2098 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -8489 2109 m 8467 1987 l 8543 2084 l 8488 1961 l 8433 1986 l cp -clip -n 8685 2475 m 8467 1987 l gs col0 s gr gr - -% arrowhead -n 8489 2109 m 8467 1987 l 8543 2084 l 8516 2097 l 8489 2109 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6352 2152 m 6382 2032 l 6412 2152 l 6412 2017 l 6352 2017 l cp -clip -n 6382 2460 m 6382 2032 l gs col0 s gr gr - -% arrowhead -n 6352 2152 m 6382 2032 l 6412 2152 l 6382 2152 l 6352 2152 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6337 2347 m 6307 2467 l 6277 2347 l 6277 2482 l 6337 2482 l cp -clip -n 6307 2032 m 6307 2467 l gs col0 s gr gr - -% arrowhead -n 6337 2347 m 6307 2467 l 6277 2347 l 6307 2347 l 6337 2347 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -5967 3272 m 5880 3360 l 5916 3242 l 5847 3358 l 5898 3388 l cp -clip -n 6180 2857 m 5880 3360 l gs col0 s gr gr - -% arrowhead -n 5967 3272 m 5880 3360 l 5916 3242 l 5941 3257 l 5967 3272 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6623 3298 m 6645 3420 l 6569 3323 l 6624 3446 l 6679 3421 l cp -clip -n 6427 2932 m 6645 3420 l gs col0 s gr gr - -% arrowhead -n 6623 3298 m 6645 3420 l 6569 3323 l 6596 3310 l 6623 3298 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6145 2998 m 6232 2910 l 6197 3029 l 6265 2912 l 6214 2882 l cp -clip -n 5962 3367 m 6232 2910 l gs col0 s gr gr - -% arrowhead -n 6145 2998 m 6232 2910 l 6197 3029 l 6171 3013 l 6145 2998 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -6509 3009 m 6487 2887 l 6563 2984 l 6508 2861 l 6453 2886 l cp -clip -n 6705 3375 m 6487 2887 l gs col0 s gr gr - -% arrowhead -n 6509 3009 m 6487 2887 l 6563 2984 l 6536 2997 l 6509 3009 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2707 2152 m 2737 2032 l 2767 2152 l 2767 2017 l 2707 2017 l cp -clip -n 2737 2460 m 2737 2032 l gs col0 s gr gr - -% arrowhead -n 2707 2152 m 2737 2032 l 2767 2152 l 2737 2152 l 2707 2152 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2692 2347 m 2662 2467 l 2632 2347 l 2632 2482 l 2692 2482 l cp -clip -n 2662 2032 m 2662 2467 l gs col0 s gr gr - -% arrowhead -n 2692 2347 m 2662 2467 l 2632 2347 l 2662 2347 l 2692 2347 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2322 3272 m 2235 3360 l 2271 3242 l 2202 3358 l 2253 3388 l cp -clip -n 2535 2857 m 2235 3360 l gs col0 s gr gr - -% arrowhead -n 2322 3272 m 2235 3360 l 2271 3242 l 2296 3257 l 2322 3272 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2978 3298 m 3000 3420 l 2924 3323 l 2979 3446 l 3034 3421 l cp -clip -n 2782 2932 m 3000 3420 l gs col0 s gr gr - -% arrowhead -n 2978 3298 m 3000 3420 l 2924 3323 l 2951 3310 l 2978 3298 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -2500 2998 m 2587 2910 l 2552 3029 l 2620 2912 l 2569 2882 l cp -clip -n 2317 3367 m 2587 2910 l gs col0 s gr gr - -% arrowhead -n 2500 2998 m 2587 2910 l 2552 3029 l 2526 3013 l 2500 2998 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -gs clippath -2864 3009 m 2842 2887 l 2918 2984 l 2863 2861 l 2808 2886 l cp -clip -n 3060 3375 m 2842 2887 l gs col0 s gr gr - -% arrowhead -n 2864 3009 m 2842 2887 l 2918 2984 l 2891 2997 l 2864 3009 l cp gs col7 1.00 shd ef gr col0 s -% Polyline -n 1575 1350 m 9225 1350 l 9225 4050 l 1575 4050 l cp gs col0 s gr -/Courier-Bold ff 180.00 scf sf -2655 1845 m -gs 1 -1 sc (y) col0 sh gr -/Courier-Bold ff 180.00 scf sf -6300 1845 m -gs 1 -1 sc (y) col0 sh gr -/Courier-Bold ff 180.00 scf sf -6285 2752 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 180.00 scf sf -2640 2752 m -gs 1 -1 sc (x) col0 sh gr -/Courier ff 180.00 scf sf -3690 2025 m -gs 1 -1 sc (let x' =) col0 sh gr -/Courier ff 180.00 scf sf -3690 2205 m -gs 1 -1 sc (x # orphaned_clone) col0 sh gr -/Courier-Bold ff 180.00 scf sf -8235 1845 m -gs 1 -1 sc (x') col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 4050 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 4050 a -2 4627 a Fp(3.2.2.)35 -b(The)f(methods)g(of)f(the)h(c)n(lass)h(type)f Fc(node)p -Black 3800 5278 a Fr(52)p Black eop -%%Page: 53 53 -53 52 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(General)g(obser)o(v)o -(ers)g(.)p Black 396 866 a Ft(\225)p Black 60 w Fq(extension)p -Fv(:)g(The)f(reference)g(to)h(the)h(e)o(xtension)d(object)i(which)g -(belongs)f(to)h(this)h(node)e(\(see)h(...\).)p Black -396 974 a Ft(\225)p Black 60 w Fq(dtd)p Fv(:)h(Returns)f(a)g(reference) -f(to)h(the)g(global)g(DTD.)g(All)h(nodes)e(of)h(a)h(tree)f(must)g -(share)g(the)g(same)h(DTD.)p Black 396 1082 a Ft(\225)p -Black 60 w Fq(parent)p Fv(:)f(Get)h(the)f(f)o(ather)f(node.)g(Raises)j -Fq(Not_found)d Fv(in)i(the)f(case)g(the)h(node)e(does)h(not)f(ha)n(v)o -(e)h(a)h(parent,)e(i.e.)h(the)479 1190 y(node)f(is)j(the)e(root.)p -Black 396 1298 a Ft(\225)p Black 60 w Fq(root)p Fv(:)g(Gets)h(the)g -(reference)d(to)i(the)h(root)e(node)g(of)h(the)g(tree.)g(Ev)o(ery)f -(node)g(is)i(contained)e(in)h(a)h(tree)f(with)h(a)f(root,)f(so)479 -1406 y(this)h(method)f(al)o(w)o(ays)h(succeeds.)e(Note)i(that)g(this)g -(method)e Fr(sear)m(c)o(hes)h Fv(the)h(root,)e(which)h(costs)h(time)g -(proportional)d(to)479 1514 y(the)j(length)g(of)g(the)g(path)g(to)g -(the)g(root.)p Black 396 1622 a Ft(\225)p Black 60 w -Fq(sub_nodes)p Fv(:)g(Returns)g(references)e(to)j(the)f(children.)f -(The)g(returned)g(list)i(re\003ects)g(the)f(order)f(of)h(the)g -(children.)e(F)o(or)479 1730 y(data)i(nodes,)g(this)g(method)f(returns) -g(the)i(empty)e(list.)p Black 396 1838 a Ft(\225)p Black -60 w Fq(iter_nodes)43 b(f)p Fv(:)21 b(Iterates)f(o)o(v)o(er)f(the)h -(children,)f(and)g(calls)i Fq(f)g Fv(for)e(e)n(v)o(ery)g(child)h(in)g -(turn.)p Black 396 1945 a Ft(\225)p Black 60 w Fq(iter_nodes_sibl)43 -b(f)p Fv(:)20 b(Iterates)g(o)o(v)o(er)f(the)h(children,)f(and)h(calls)g -Fq(f)h Fv(for)f(e)n(v)o(ery)e(child)i(in)h(turn.)e Fq(f)h -Fv(gets)h(as)479 2053 y(ar)o(guments)d(the)j(pre)n(vious)d(node,)h(the) -h(current)f(node,)g(and)h(the)g(ne)o(xt)f(node.)p Black -396 2161 a Ft(\225)p Black 60 w Fq(node_type)p Fv(:)h(Returns)g(either) -f Fq(T_data)h Fv(which)g(means)g(that)g(the)g(node)f(is)i(a)g(data)f -(node,)f(or)h Fq(T_element)43 b(n)479 2269 y Fv(which)20 -b(means)g(that)g(the)g(node)f(is)j(an)e(element)f(of)h(type)g -Fq(n)p Fv(.)g(If)g(con\002gured,)e(possible)i(node)f(types)h(are)g -(also)479 2377 y Fq(T_pinstr)44 b(t)20 b Fv(indicating)f(that)h(the)h -(node)e(represents)g(a)i(processing)e(instruction)g(with)h(tar)o(get)f -Fq(t)p Fv(,)i(and)479 2485 y Fq(T_comment)f Fv(in)g(which)g(case)g(the) -g(node)g(is)h(a)f(comment.)p Black 396 2593 a Ft(\225)p -Black 60 w Fq(encoding)p Fv(:)g(Returns)g(the)g(encoding)e(of)i(the)g -(strings.)p Black 396 2701 a Ft(\225)p Black 60 w Fq(data)p -Fv(:)g(Returns)g(the)h(character)e(data)h(of)g(this)g(node)f(and)h(all) -h(children,)d(concatenated)h(as)i(one)e(string.)h(The)479 -2809 y(encoding)e(of)i(the)h(string)e(is)j(what)e(the)g(method)f -Fq(encoding)g Fv(returns.)g(-)i(F)o(or)e(data)h(nodes,)g(this)g(method) -f(simply)479 2917 y(returns)h(the)g(represented)e(characters.)h(F)o(or) -h(elements,)g(the)g(meaning)f(of)g(the)i(method)d(has)j(been)e(e)o -(xtended)g(such)479 3025 y(that)i(it)f(returns)g(something)e(useful,)i -(i.e.)g(the)g(ef)n(fecti)n(v)o(ely)f(contained)f(characters,)h(without) -h(markup.)e(\(F)o(or)479 3133 y Fq(T_pinstr)i Fv(and)f -Fq(T_comment)h Fv(nodes,)f(the)h(method)f(returns)g(the)h(empty)g -(string.\))p Black 396 3241 a Ft(\225)p Black 60 w Fq(position)p -Fv(:)g(If)g(con\002gured,)d(this)k(method)e(returns)g(the)h(position)g -(of)g(the)g(element)g(as)g(triple)g(\(entity)-5 b(,)19 -b(line,)479 3349 y(byteposition\).)f(F)o(or)i(data)g(nodes,)f(the)h -(position)g(is)h(not)f(stored.)f(If)h(the)g(position)g(is)h(not)f(a)n -(v)n(ailable)f(the)i(triple)f Fq("?",)479 3456 y(0,)45 -b(0)20 b Fv(is)h(returned.)p Black 396 3564 a Ft(\225)p -Black 60 w Fq(comment)p Fv(:)f(Returns)g Fq(Some)44 b(text)20 -b Fv(for)f(comment)g(nodes,)g(and)g Fq(None)h Fv(for)g(other)f(nodes.)g -(The)h Fq(text)f Fv(is)i(e)n(v)o(erything)479 3672 y(between)f(the)g -(comment)f(delimiters)g Fo(<)p Fq(-)i Fv(and)e Fq(-)p -Fo(>)p Fv(.)p Black 396 3780 a Ft(\225)p Black 60 w Fq(pinstr)44 -b(n)p Fv(:)21 b(Returns)f(all)h(processing)d(instructions)i(that)g(are) -g(directly)f(contained)g(in)h(this)h(element)e(and)h(that)g(ha)n(v)o(e) -479 3888 y(a)h Fr(tar)m(g)o(et)h Fv(speci\002cation)d(of)h -Fq(n)p Fv(.)g(The)g(tar)o(get)f(is)j(the)e(\002rst)h(w)o(ord)e(after)h -(the)g Fo(<)p Fq(?)p Fv(.)p Black 396 3996 a Ft(\225)p -Black 60 w Fq(pinstr_names)p Fv(:)f(Returns)h(the)g(list)i(of)e(all)g -(tar)o(gets)g(of)g(processing)f(instructions)g(directly)g(contained)g -(in)h(this)479 4104 y(element.)p Black 396 4212 a Ft(\225)p -Black 60 w Fq(write)44 b(s)h(enc)p Fv(:)20 b(Prints)h(the)f(node)f(and) -h(all)h(subnodes)d(to)j(the)f(passed)g(output)f(stream)h(as)h(v)n(alid) -f(XML)g(te)o(xt,)g(using)479 4320 y(the)g(passed)h(e)o(xternal)e -(encoding.)396 4511 y Fu(Attrib)n(ute)h(obser)o(v)o(ers)h(.)p -Black 396 4743 a Ft(\225)p Black 60 w Fq(attribute)44 -b(n)p Fv(:)20 b(Returns)g(the)h(v)n(alue)e(of)h(the)g(attrib)n(ute)g -(with)g(name)g Fq(n)p Fv(.)g(This)h(method)d(returns)i(a)g(v)n(alue)g -(for)f(e)n(v)o(ery)479 4851 y(declared)g(attrib)n(ute,)h(and)f(it)i -(raises)g Fq(Not_found)e Fv(for)h(an)o(y)f(undeclared)f(attrib)n(ute.)i -(Note)g(that)g(it)h(e)n(v)o(en)e(returns)h(a)p Black -3800 5278 a Fr(53)p Black eop -%%Page: 54 54 -54 53 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 479 579 a Fv(v)n(alue)g(if)g(the)g -(attrib)n(ute)g(is)h(actually)f(missing)g(b)n(ut)g(is)h(declared)e(as)i -Fq(#IMPLIED)f Fv(or)g(has)g(a)h(def)o(ault)e(v)n(alue.)g(-)i(Possible) -479 687 y(v)n(alues)f(are:)p Black 479 919 a Fa(\225)p -Black 62 w Fq(Implied_value)p Fv(:)f(The)h(attrib)n(ute)g(has)g(been)g -(declared)e(with)j(the)f(k)o(e)o(yw)o(ord)e Fq(#IMPLIED)p -Fv(,)i(and)f(the)h(attrib)n(ute)g(is)562 1027 y(missing)g(in)h(the)f -(attrib)n(ute)g(list)h(of)f(this)h(element.)p Black 479 -1135 a Fa(\225)p Black 62 w Fq(Value)44 b(s)p Fv(:)21 -b(The)f(attrib)n(ute)g(has)g(been)g(declared)e(as)j(type)f -Fq(CDATA)p Fv(,)g(as)h Fq(ID)p Fv(,)f(as)h Fq(IDREF)p -Fv(,)e(as)i Fq(ENTITY)p Fv(,)f(or)g(as)562 1243 y Fq(NMTOKEN)p -Fv(,)g(or)g(as)g(enumeration)e(or)i(notation,)f(and)g(one)h(of)g(the)g -(tw)o(o)h(conditions)d(holds:)i(\(1\))g(The)g(attrib)n(ute)562 -1351 y(v)n(alue)g(is)h(present)e(in)i(the)f(attrib)n(ute)g(list)h(in)f -(which)g(case)h(the)f(v)n(alue)f(is)j(returned)c(in)i(the)h(string)e -Fq(s)p Fv(.)i(\(2\))e(The)562 1459 y(attrib)n(ute)h(has)h(been)e -(omitted,)g(and)h(the)g(DTD)g(declared)f(the)i(attrib)n(ute)e(with)i(a) -f(def)o(ault)g(v)n(alue.)f(The)h(def)o(ault)562 1567 -y(v)n(alue)f(is)i(returned)d(in)i Fq(s)p Fv(.)g(-)g(Summarized,)d -Fq(Value)44 b(s)20 b Fv(is)h(returned)d(for)h(non-implied,)e(non-list)i -(attrib)n(ute)g(v)n(alues.)p Black 479 1675 a Fa(\225)p -Black 62 w Fq(Valuelist)44 b(l)p Fv(:)20 b(The)g(attrib)n(ute)g(has)g -(been)g(declared)f(as)i(type)e Fq(IDREFS)p Fv(,)h(as)h -Fq(ENTITIES)p Fv(,)e(or)h(as)h Fq(NMTOKENS)p Fv(,)562 -1783 y(and)f(one)g(of)f(the)i(tw)o(o)f(conditions)f(holds:)h(\(1\))f -(The)h(attrib)n(ute)g(v)n(alue)f(is)i(present)f(in)g(the)h(attrib)n -(ute)e(list)j(in)e(which)562 1891 y(case)h(the)f(space-separated)e(tok) -o(ens)i(of)g(the)g(v)n(alue)g(are)g(returned)e(in)j(the)f(string)g -(list)h Fq(l)p Fv(.)f(\(2\))g(The)g(attrib)n(ute)g(has)562 -1999 y(been)g(omitted,)f(and)h(the)g(DTD)g(declared)f(the)h(attrib)n -(ute)g(with)h(a)f(def)o(ault)g(v)n(alue.)f(The)h(def)o(ault)f(v)n(alue) -h(is)h(returned)562 2107 y(in)g Fq(l)p Fv(.)f(-)g(Summarized,)f -Fq(Valuelist)43 b(l)20 b Fv(is)i(returned)c(for)i(all)g(list-type)g -(attrib)n(ute)g(v)n(alues.)396 2256 y(Note)g(that)h(before)d(the)j -(attrib)n(ute)f(v)n(alue)f(is)i(returned,)d(the)i(v)n(alue)g(is)h -(normalized.)d(This)j(means)e(that)i(ne)n(wlines)e(are)479 -2364 y(con)m(v)o(erted)f(to)i(spaces,)g(and)g(that)g(references)f(to)h -(character)f(entities)i(\(i.e.)f Fq(&#)p Fn(n)p Fq(;)p -Fv(\))g(and)f(general)g(entities)i(\(i.e.)479 2472 y -Fq(&)p Fn(name)p Fq(;)p Fv(\))f(are)g(e)o(xpanded;)e(if)i(necessary)-5 -b(,)19 b(e)o(xpansion)f(is)j(performed)d(recursi)n(v)o(ely)-5 -b(.)479 2621 y(In)20 b(well-formedness)e(mode,)h(there)h(is)h(no)f(DTD) -g(which)g(could)f(declare)h(an)g(attrib)n(ute.)f(Because)i(of)f(this,)g -(e)n(v)o(ery)479 2729 y(occuring)f(attrib)n(ute)g(is)i(considered)e(as) -i(a)f(CD)m(A)-9 b(T)h(A)21 b(attrib)n(ute.)p Black 396 -2879 a Ft(\225)p Black 60 w Fq(required_string_attribute)41 -b(n)p Fv(:)21 b(returns)e(the)h(V)-9 b(alue)20 b(attrib)n(ute)g(called) -g(n,)g(or)g(the)g(V)-9 b(aluelist)20 b(attrib)n(ute)g(as)h(a)479 -2987 y(string)f(where)g(the)g(list)h(elements)f(are)g(separated)f(by)h -(spaces.)g(If)h(the)f(attrib)n(ute)g(v)n(alue)f(is)i(implied,)e(or)h -(if)h(the)479 3094 y(attrib)n(ute)f(does)g(not)g(e)o(xists,)g(the)g -(method)f(will)i(f)o(ail.)g(-)f(This)g(method)f(is)i(con)m(v)o(enient)d -(if)i(you)g(e)o(xpect)f(a)h(non-implied)479 3202 y(and)g(non-list)f -(attrib)n(ute)h(v)n(alue.)p Black 396 3310 a Ft(\225)p -Black 60 w Fq(optional_string_attribute)41 b(n)p Fv(:)21 -b(returns)e(the)h(V)-9 b(alue)20 b(attrib)n(ute)g(called)g(n,)g(or)g -(the)g(V)-9 b(aluelist)20 b(attrib)n(ute)g(as)h(a)479 -3418 y(string)f(where)g(the)g(list)h(elements)f(are)g(separated)f(by)h -(spaces.)g(If)h(the)f(attrib)n(ute)g(v)n(alue)f(is)i(implied,)e(or)h -(if)h(the)479 3526 y(attrib)n(ute)f(does)g(not)g(e)o(xists,)g(the)g -(method)f(returns)h(None.)f(-)h(This)h(method)e(is)i(con)m(v)o(enient)c -(if)k(you)e(e)o(xpect)g(a)i(non-list)479 3634 y(attrib)n(ute)f(v)n -(alue)g(including)e(the)i(implied)g(v)n(alue.)p Black -396 3742 a Ft(\225)p Black 60 w Fq(required_list_attribute)41 -b(n)p Fv(:)20 b(returns)f(the)g(V)-9 b(aluelist)20 b(attrib)n(ute)f -(called)g(n,)g(or)g(the)h(V)-9 b(alue)19 b(attrib)n(ute)g(as)h(a)g -(list)479 3850 y(with)h(a)f(single)g(element.)g(If)g(the)g(attrib)n -(ute)g(v)n(alue)f(is)i(implied,)f(or)g(if)g(the)g(attrib)n(ute)g(does)g -(not)g(e)o(xists,)g(the)g(method)479 3958 y(will)h(f)o(ail.)g(-)f(This) -g(method)f(is)i(con)m(v)o(enient)d(if)i(you)g(e)o(xpect)f(a)h(list)i -(attrib)n(ute)d(v)n(alue.)p Black 396 4066 a Ft(\225)p -Black 60 w Fq(optional_list_attribute)41 b(n)p Fv(:)20 -b(returns)f(the)g(V)-9 b(aluelist)20 b(attrib)n(ute)f(called)g(n,)g(or) -g(the)h(V)-9 b(alue)19 b(attrib)n(ute)g(as)h(a)g(list)479 -4174 y(with)h(a)f(single)g(element.)g(If)g(the)g(attrib)n(ute)g(v)n -(alue)f(is)i(implied,)f(or)g(if)g(the)g(attrib)n(ute)g(does)g(not)g(e)o -(xists,)g(an)g(empty)g(list)479 4282 y(will)h(be)f(returned.)e(-)j -(This)f(method)f(is)i(con)m(v)o(enient)d(if)i(you)f(e)o(xpect)h(a)g -(list)i(attrib)n(ute)d(v)n(alue)h(or)g(the)g(implied)f(v)n(alue.)p -Black 396 4390 a Ft(\225)p Black 60 w Fq(attribute_names)p -Fv(:)g(returns)g(the)h(list)h(of)f(all)h(attrib)n(ute)f(names)g(of)g -(this)g(element.)g(As)h(this)f(is)i(a)e(v)n(alidating)479 -4498 y(parser)m(,)f(this)i(list)g(is)g(equal)f(to)g(the)h(list)g(of)f -(declared)f(attrib)n(utes.)p Black 396 4605 a Ft(\225)p -Black 60 w Fq(attribute_type)43 b(n)p Fv(:)20 b(returns)g(the)g(type)g -(of)g(the)g(attrib)n(ute)g(called)g Fq(n)p Fv(.)g(See)h(the)f(module)f -Fq(Pxp_types)g Fv(for)g(a)479 4713 y(description)g(of)h(the)g(encoding) -e(of)i(the)g(types.)p Black 396 4821 a Ft(\225)p Black -60 w Fq(attributes)p Fv(:)f(returns)h(the)g(list)h(of)f(pairs)g(of)g -(names)g(and)g(v)n(alues)g(for)f(all)i(attrib)n(utes)f(of)g(this)h -(element.)p Black 3800 5278 a Fr(54)p Black eop -%%Page: 55 55 -55 54 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black Black 396 579 a Ft(\225)p -Black 60 w Fq(id_attribute_name)p Fv(:)e(returns)h(the)i(name)e(of)h -(the)g(attrib)n(ute)g(that)g(is)h(declared)e(with)h(type)g(ID.)g(There) -f(is)i(at)g(most)479 687 y(one)f(such)g(attrib)n(ute.)f(The)h(method)f -(raises)i Fq(Not_found)e Fv(if)i(there)e(is)i(no)f(declared)f(ID)i -(attrib)n(ute)e(for)h(the)g(element)479 795 y(type.)p -Black 396 903 a Ft(\225)p Black 60 w Fq(id_attribute_value)p -Fv(:)e(returns)h(the)i(v)n(alue)e(of)h(the)g(attrib)n(ute)g(that)g(is)h -(declared)e(with)i(type)e(ID.)i(There)e(is)i(at)479 1011 -y(most)g(one)e(such)h(attrib)n(ute.)g(The)g(method)e(raises)j -Fq(Not_found)e Fv(if)i(there)f(is)h(no)e(declared)g(ID)i(attrib)n(ute)f -(for)f(the)479 1119 y(element)h(type.)p Black 396 1226 -a Ft(\225)p Black 60 w Fq(idref_attribute_names)p Fv(:)d(returns)h(the) -h(list)i(of)e(attrib)n(ute)f(names)h(that)h(are)f(declared)f(as)i -(IDREF)f(or)g(IDREFS.)396 1417 y Fu(Modifying)h(methods)h(.)f -Fv(The)g(follo)n(wing)f(methods)g(are)h(only)f(de\002ned)g(for)h -(element)f(nodes)h(\(more)f(e)o(xactly:)g(the)396 1525 -y(methods)g(are)i(de\002ned)e(for)g(data)h(nodes,)f(too,)h(b)n(ut)g(f)o -(ail)h(al)o(w)o(ays\).)p Black 396 1758 a Ft(\225)p Black -60 w Fq(add_node)44 b(sn)p Fv(:)20 b(Adds)g(sub)g(node)g -Fq(sn)g Fv(to)g(the)g(list)i(of)e(children.)e(This)j(operation)d(is)j -(illustrated)f(in)g(the)g(picture)g Fr(A)479 1866 y(node)f(can)h(only)g -(be)g(added)f(if)h(it)h(is)h(a)e(r)l(oot)q Fv(.)g(This)h(method)e(e)o -(xpects)g(that)h Fq(sn)h Fv(is)g(a)g(root,)e(and)g(it)i(requires)f -(that)g Fq(sn)g Fv(and)479 1974 y(the)g(current)f(object)h(share)g(the) -g(same)h(DTD.)479 2123 y(Because)g Fq(add_node)e Fv(is)i(the)f(method)f -(the)h(parser)g(itself)h(uses)g(to)f(add)g(ne)n(w)g(nodes)f(to)h(the)h -(tree,)e(it)i(performs)e(by)479 2231 y(def)o(ault)h(some)g(simple)g(v)n -(alidation)f(checks:)g(If)h(the)h(content)e(model)g(is)i(a)g(re)o -(gular)e(e)o(xpression,)f(it)j(is)g(not)f(allo)n(wed)f(to)479 -2339 y(add)h(data)g(nodes)f(to)i(this)g(node)e(unless)h(the)g(ne)n(w)g -(nodes)g(consist)g(only)f(of)h(whitespace.)g(In)g(this)g(case,)h(the)f -(ne)n(w)g(data)479 2447 y(nodes)g(are)g(silently)g(dropped)e(\(you)h -(can)h(change)f(this)h(by)g(in)m(v)n(oking)e Fq -(keep_always_whitespace_mode)p Fv(\).)479 2596 y(If)i(the)h(document)d -(is)j(\003agged)e(as)i(stand-alone,)d(these)j(data)f(nodes)f(only)g -(containing)g(whitespace)g(are)h(e)n(v)o(en)479 2704 -y(forbidden)e(if)i(the)h(element)e(declaration)g(is)i(contained)d(in)j -(an)f(e)o(xternal)f(entity)-5 b(.)19 b(This)h(case)h(is)g(detected)f -(and)479 2812 y(rejected.)479 2962 y(If)g(the)h(content)e(model)g(is)i -Fq(EMPTY)p Fv(,)f(it)h(is)g(not)f(allo)n(wed)f(to)i(add)e(an)o(y)h -(data)g(node)f(unless)h(the)g(data)g(node)g(is)h(empty)-5 -b(.)18 b(In)479 3070 y(this)j(case,)f(the)h(ne)n(w)f(data)g(node)f(is)i -(silently)f(dropped.)479 3219 y(These)g(checks)g(only)f(apply)h(if)g -(there)g(is)h(a)f(DTD.)h(In)f(well-formedness)e(mode,)h(it)i(is)g -(assumed)e(that)i(e)n(v)o(ery)d(element)479 3327 y(is)j(declared)e -(with)i(content)e(model)g Fq(ANY)h Fv(which)g(prohibits)f(an)o(y)g(v)n -(alidation)g(check.)g(Furthermore,)f(you)h(turn)h(these)479 -3435 y(checks)g(of)n(f)f(by)h(passing)g Fq(~force:true)f -Fv(as)i(\002rst)g(ar)o(gument.)p Black 396 3584 a Ft(\225)p -Black 60 w Fq(add_pinstr)43 b(pi)p Fv(:)21 b(Adds)f(the)g(processing)f -(instruction)g Fq(pi)h Fv(to)h(the)f(list)h(of)f(processing)f -(instructions.)p Black 396 3692 a Ft(\225)p Black 60 -w Fq(delete)p Fv(:)h(Deletes)h(this)g(node)e(from)g(the)h(tree.)g -(After)g(this)h(operation,)d(this)i(node)g(is)h(no)f(longer)e(the)j -(child)e(of)h(the)479 3800 y(former)f(f)o(ather)g(node;)f(and)i(the)g -(node)e(loses)j(the)e(connection)f(to)i(the)g(f)o(ather)f(as)h(well.)h -(This)e(operation)f(is)j(illustrated)479 3908 y(by)f(the)g(\002gure)g -Fr(A)g(deleted)g(node)f(becomes)g(the)i(r)l(oot)f(of)g(the)h(subtr)m -(ee)p Fv(.)p Black 396 4016 a Ft(\225)p Black 60 w Fq(set_nodes)44 -b(nl)p Fv(:)20 b(Sets)h(the)f(list)i(of)e(children)e(to)j -Fq(nl)p Fv(.)f(It)g(is)i(required)c(that)i(e)n(v)o(ery)f(member)g(of)h -Fq(nl)g Fv(is)h(a)g(root,)e(and)479 4124 y(that)i(all)f(members)f(and)h -(the)g(current)f(object)h(share)g(the)g(same)g(DTD.)g(Unlik)o(e)g -Fq(add_node)p Fv(,)g(no)f(v)n(alidation)g(checks)479 -4232 y(are)h(performed.)p Black 396 4340 a Ft(\225)p -Black 60 w Fq(quick_set_attributes)42 b(atts)p Fv(:)20 -b(sets)h(the)f(attrib)n(utes)h(of)e(this)i(element)f(to)g -Fq(atts)p Fv(.)g(It)g(is)i Fr(not)f Fv(check)o(ed)479 -4448 y(whether)e Fq(atts)i Fv(matches)e(the)i(DTD)f(or)g(not;)g(it)h -(is)g(up)f(to)g(the)g(caller)g(of)g(this)h(method)e(to)h(ensure)g -(this.)g(\(This)479 4556 y(method)f(may)h(be)g(useful)g(to)g(transform) -e(the)j(attrib)n(ute)f(v)n(alues,)f(i.e.)h(apply)f(a)i(mapping)d(to)j -(e)n(v)o(ery)e(attrib)n(ute.\))p Black 396 4664 a Ft(\225)p -Black 60 w Fq(set_comment)43 b(text)p Fv(:)20 b(This)h(method)e(is)i -(only)e(applicable)g(to)h Fq(T_comment)g Fv(nodes;)f(it)i(sets)g(the)g -(comment)d(te)o(xt)479 4772 y(contained)h(by)h(such)g(nodes.)p -Black 3800 5278 a Fr(55)p Black eop -%%Page: 56 56 -56 55 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(Cloning)g(methods)h(.) -p Black 396 811 a Ft(\225)p Black 60 w Fq(orphaned_clone)p -Fv(:)e(Returns)h(a)g(clone)g(of)g(the)g(node)f(and)h(the)g(complete)f -(tree)h(belo)n(w)g(this)h(node)e(\(deep)g(clone\).)479 -919 y(The)h(clone)g(does)g(not)g(ha)n(v)o(e)f(a)i(parent)e(\(i.e.)h -(the)g(reference)f(to)h(the)g(parent)f(node)g(is)j Fr(not)f -Fv(cloned\).)d(While)j(cop)o(ying)479 1027 y(the)f(subtree,)g(strings)g -(are)g(skipped;)f(it)i(is)g(lik)o(ely)f(that)h(the)f(original)f(tree)h -(and)g(the)g(cop)o(y)f(tree)h(share)g(strings.)479 1135 -y(Extension)f(objects)h(are)g(cloned)f(by)h(in)m(v)n(oking)e(the)i -Fq(clone)g Fv(method)f(on)h(the)g(original)f(objects;)h(ho)n(w)g(much)f -(of)h(the)479 1243 y(e)o(xtension)f(objects)h(is)h(cloned)e(depends)g -(on)h(the)g(implemention)e(of)i(this)h(method.)479 1393 -y(This)g(operation)d(is)j(illustrated)f(by)g(the)g(\002gure)f -Fr(The)i(clone)e(of)i(a)f(subtr)m(ee)p Fv(.)p Black 396 -1542 a Ft(\225)p Black 60 w Fq(orphaned_flat_clone)p -Fv(:)e(Returns)i(a)h(clone)e(of)h(the)g(node,)f(b)n(ut)h(sets)i(the)e -(list)h(of)f(sub)g(nodes)g(to)g([],)g(i.e.)g(the)g(sub)479 -1650 y(nodes)g(are)g(not)g(cloned.)p Black 396 1758 a -Ft(\225)p Black 81 w Fq(create_element)42 b(dtd)i(nt)h(al)p -Fv(:)20 b(Returns)f(a)i(\003at)f(cop)o(y)f(of)g(this)i(node)d(\(which)h -(must)h(be)f(an)h(element\))f(with)h(the)479 1866 y(follo)n(wing)f -(modi\002cations:)g(The)h(DTD)g(is)h(set)g(to)f Fq(dtd)p -Fv(;)h(the)f(node)f(type)h(is)h(set)g(to)f Fq(nt)p Fv(,)g(and)g(the)g -(ne)n(w)g(attrib)n(ute)g(list)h(is)479 1974 y(set)g(to)f -Fq(al)g Fv(\(gi)n(v)o(en)e(as)i(list)h(of)f(\(name,v)n(alue\))d -(pairs\).)i(The)g(cop)o(y)g(does)h(not)f(ha)n(v)o(e)g(children)g(nor)g -(a)h(parent.)f(It)h(does)f(not)479 2082 y(contain)g(processing)g -(instructions.)g(See)i(the)f(e)o(xample)f(belo)n(w.)479 -2231 y(Note)h(that)h(you)e(can)h(specify)g(the)g(position)f(of)h(the)g -(ne)n(w)g(node)f(by)h(the)g(optional)f(ar)o(gument)f -Fq(~position)p Fv(.)p Black 396 2380 a Ft(\225)p Black -81 w Fq(create_data)43 b(dtd)h(cdata)p Fv(:)20 b(Returns)g(a)h(\003at)g -(cop)o(y)e(of)h(this)h(node)e(\(which)g(must)h(be)h(a)f(data)g(node\))f -(with)h(the)479 2488 y(follo)n(wing)f(modi\002cations:)g(The)h(DTD)g -(is)h(set)g(to)f Fq(dtd)p Fv(;)h(the)f(node)f(type)h(is)h(set)g(to)f -Fq(T_data)p Fv(;)g(the)g(attrib)n(ute)g(list)h(is)479 -2596 y(empty)f(\(data)f(nodes)h(ne)n(v)o(er)f(ha)n(v)o(e)g(attrib)n -(utes\);)h(the)g(list)h(of)f(children)f(and)h(PIs)h(is)g(empty)-5 -b(,)19 b(too)g(\(same)h(reason\).)f(The)479 2704 y(ne)n(w)h(node)f -(does)h(not)g(ha)n(v)o(e)g(a)g(parent.)f(The)h(v)n(alue)g -Fq(cdata)g Fv(is)h(the)f(ne)n(w)g(character)f(content)g(of)h(the)g -(node.)f(See)i(the)479 2812 y(e)o(xample)e(belo)n(w.)p -Black 396 2920 a Ft(\225)p Black 60 w Fq(keep_always_whitespace_mode)p -Fv(:)e(Ev)o(en)i(data)h(nodes)f(which)h(are)g(normally)f(dropped)e -(because)j(the)o(y)f(only)479 3028 y(contain)g(ignorable)f(whitespace,) -h(can)h(added)e(to)i(this)h(node)d(once)h(this)i(mode)e(is)h(turned)f -(on.)g(\(This)h(mode)f(is)h(useful)479 3136 y(to)h(produce)d(canonical) -h(XML.\))396 3327 y Fu(V)-8 b(alidating)20 b(methods)h(.)f -Fv(There)f(is)j(one)d(method)g(which)h(locally)f(v)n(alidates)h(the)g -(node,)f(i.e.)i(checks)e(whether)g(the)396 3435 y(subnodes)g(match)h -(the)g(content)f(model)g(of)h(this)h(node.)p Black 396 -3667 a Ft(\225)p Black 60 w Fq(local_validate)p Fv(:)e(Checks)h(that)g -(this)h(node)e(conforms)f(to)j(the)f(DTD)g(by)g(comparing)e(the)i(type) -g(of)g(the)479 3775 y(subnodes)e(with)i(the)g(content)e(model)h(for)g -(this)h(node.)e(\(Applications)g(need)h(not)g(call)h(this)h(method)d -(unless)h(the)o(y)g(add)479 3883 y(ne)n(w)h(nodes)g(themselv)o(es)f(to) -i(the)f(tree.\))-2 4294 y Fp(3.2.3.)35 b(The)f(c)n(lass)h -Fc(element_impl)396 4462 y Fv(This)21 b(class)g(is)g(an)f -(implementation)e(of)i Fq(node)g Fv(which)g(realizes)g(element)g -(nodes:)396 4642 y Fq(class)44 b([)h('ext)f(])h(element_impl)e(:)h -('ext)g(->)h([)g('ext)f(])g(node)396 4875 y Fu(Constructor)-8 -b(.)19 b Fv(Y)-9 b(ou)20 b(can)g(create)f(a)i(ne)n(w)f(instance)g(by)p -Black 3798 5278 a Fr(56)p Black eop -%%Page: 57 57 -57 56 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fq(new)45 -b(element_impl)d Fn(extension_object)396 770 y Fv(which)20 -b(creates)g(a)h(special)f(form)f(of)h(empty)f(element)h(which)g -(already)f(contains)g(a)i(reference)d(to)j(the)396 878 -y Fl(extension_object)p Fv(,)d(b)n(ut)i(is)h(otherwise)f(empty)-5 -b(.)18 b(This)j(special)f(form)f(is)i(called)f(an)g Fr(e)n(xemplar)r -Fv(.)g(The)g(purpose)f(of)396 986 y(e)o(x)o(emplars)g(is)i(that)f(the)o -(y)g(serv)o(e)f(as)i(patterns)f(that)g(can)g(be)g(duplicated)f(and)g -(\002lled)i(with)f(data.)g(The)g(method)396 1094 y Fq(create_element)f -Fv(is)i(designed)e(to)h(perform)e(this)j(action.)396 -1243 y Fu(Example.)f Fv(First,)h(create)f(an)g(e)o(x)o(emplar)e(by)396 -1423 y Fq(let)45 b(exemplar_ext)d(=)j(...)f(in)396 1520 -y(let)h(exemplar)222 b(=)45 b(new)f(element_impl)f(exemplar_ext)g(in) -396 1711 y Fv(The)20 b Fq(exemplar)g Fv(is)h(not)f(used)f(in)i(node)e -(trees,)h(b)n(ut)g(only)g(as)h(a)f(pattern)g(when)f(the)h(element)g -(nodes)f(are)i(created:)396 1891 y Fq(let)45 b(element)e(=)i(exemplar)e -(#)i(create_element)e(dtd)h(\(T_element)f(name\))h(attlist)396 -2082 y Fv(The)20 b Fq(element)g Fv(is)h(a)f(cop)o(y)g(of)g -Fq(exemplar)f Fv(\(e)n(v)o(en)g(the)h(e)o(xtension)f -Fq(exemplar_ext)g Fv(has)h(been)g(copied\))e(which)396 -2190 y(ensures)h(that)h Fq(element)f Fv(and)g(its)i(e)o(xtension)d(are) -i(objects)f(of)h(the)f(same)h(class)h(as)f(the)g(e)o(x)o(emplars;)e -(note)h(that)h(you)e(need)396 2298 y(not)i(to)g(pass)h(a)g(class)g -(name)f(or)f(other)h(meta)g(information.)d(The)j(cop)o(y)g(is)h -(initially)f(connected)e(with)j(the)f Fq(dtd)p Fv(,)g(it)h(gets)f(a)396 -2406 y(node)f(type,)h(and)g(the)g(attrib)n(ute)g(list)h(is)g(\002lled.) -f(The)g Fq(element)g Fv(is)h(no)n(w)e(fully)h(functional;)e(it)j(can)f -(be)g(added)f(to)i(another)396 2514 y(element)f(as)h(child,)e(and)h(it) -h(can)f(contain)f(references)g(to)h(subnodes.)-2 2884 -y Fp(3.2.4.)35 b(The)f(c)n(lass)h Fc(data_impl)396 3051 -y Fv(This)21 b(class)g(is)g(an)f(implementation)e(of)i -Fq(node)g Fv(which)g(should)f(be)h(used)g(for)f(all)i(character)e(data) -h(nodes:)396 3232 y Fq(class)44 b([)h('ext)f(])h(data_impl)e(:)i('ext)f -(->)g([)h('ext)f(])h(node)396 3464 y Fu(Constructor)-8 -b(.)19 b Fv(Y)-9 b(ou)20 b(can)g(create)f(a)i(ne)n(w)f(instance)g(by) -396 3644 y Fq(new)45 b(data_impl)e Fn(extension_object)396 -3835 y Fv(which)20 b(creates)g(an)g(empty)g(e)o(x)o(emplar)e(node)h -(which)h(is)h(connected)d(to)i Fl(extension_object)p -Fv(.)e(The)i(node)f(does)396 3943 y(not)h(contain)f(a)i(reference)d(to) -j(an)o(y)e(DTD,)h(and)g(because)f(of)h(this)h(it)g(cannot)e(be)h(added) -f(to)i(node)e(trees.)396 4093 y(T)-7 b(o)21 b(get)f(a)g(fully)g(w)o -(orking)f(data)h(node,)f(apply)g(the)h(method)f Fq(create_data)g -Fv(to)h(the)g(e)o(x)o(emplar)f(\(see)h(e)o(xample\).)396 -4242 y Fu(Example.)g Fv(First,)h(create)f(an)g(e)o(x)o(emplar)e(by)396 -4422 y Fq(let)45 b(exemplar_ext)d(=)j(...)f(in)396 4519 -y(let)h(exemplar)222 b(=)45 b(new)f(exemplar_ext)f(data_impl)h(in)396 -4710 y Fv(The)20 b Fq(exemplar)g Fv(is)h(not)f(used)f(in)i(node)e -(trees,)h(b)n(ut)g(only)g(as)h(a)f(pattern)g(when)f(the)h(data)g(nodes) -g(are)g(created:)p Black 3797 5278 a Fr(57)p Black eop -%%Page: 58 58 -58 57 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fq(let)45 -b(data_node)e(=)i(exemplar)e(#)i(create_data)e(dtd)h("The)g(characters) -f(con-)396 676 y(tained)h(in)h(the)f(data)g(node")396 -867 y Fv(The)20 b Fq(data_node)f Fv(is)i(a)g(cop)o(y)e(of)h -Fq(exemplar)p Fv(.)g(The)f(cop)o(y)h(is)h(initially)f(connected)e(with) -j(the)f Fq(dtd)p Fv(,)g(and)f(it)i(is)h(\002lled)396 -975 y(with)f(character)e(material.)g(The)h Fq(data_node)f -Fv(is)i(no)n(w)f(fully)g(functional;)e(it)j(can)f(be)g(added)f(to)h(an) -h(element)e(as)i(child.)-2 1345 y Fp(3.2.5.)35 b(The)f(type)g -Fc(spec)396 1512 y Fv(The)20 b(type)g Fq(spec)g Fv(de\002nes)g(a)g(w)o -(ay)h(to)f(handle)f(the)h(details)h(of)f(creating)f(nodes)g(from)h(e)o -(x)o(emplars.)396 1692 y Fq(type)44 b('ext)h(spec)396 -1790 y(constraint)e('ext)i(=)f('ext)g(node)h(#extension)396 -1984 y(val)g(make_spec_from_mapping)c(:)665 2081 y -(?super_root_exemplar)h(:)i('ext)h(node)f(->)665 2178 -y(?comment_exemplar)e(:)j('ext)f(node)g(->)665 2275 y -(?default_pinstr_exemplar)d(:)k('ext)f(node)g(->)665 -2372 y(?pinstr_mapping)f(:)h(\(string,)g('ext)g(node\))g(Hashtbl.t)f -(->)665 2469 y(data_exemplar:)g('ext)h(node)g(->)665 -2567 y(default_element_exemplar:)d('ext)j(node)g(->)665 -2664 y(element_mapping:)e(\(string,)i('ext)g(node\))g(Hashtbl.t)f(->) -665 2761 y(unit)h(->)755 2858 y('ext)g(spec)396 3052 -y(val)h(make_spec_from_alist)c(:)665 3149 y(?super_root_exemplar)h(:)i -('ext)h(node)f(->)665 3247 y(?comment_exemplar)e(:)j('ext)f(node)g(->) -665 3344 y(?default_pinstr_exemplar)d(:)k('ext)f(node)g(->)665 -3441 y(?pinstr_alist)f(:)i(\(string)e(*)i('ext)f(node\))g(list)g(->)665 -3538 y(data_exemplar:)f('ext)h(node)g(->)665 3635 y -(default_element_exemplar:)d('ext)j(node)g(->)665 3732 -y(element_alist:)f(\(string)g(*)i('ext)f(node\))g(list)g(->)665 -3829 y(unit)g(->)755 3927 y('ext)g(spec)396 4117 y Fv(The)20 -b(tw)o(o)h(functions)d Fq(make_spec_from_mapping)f Fv(and)j -Fq(make_spec_from_alist)d Fv(create)j Fq(spec)g Fv(v)n(alues.)396 -4225 y(Both)g(functions)f(are)h(functionally)e(equi)n(v)n(alent)h(and)g -(the)i(only)e(dif)n(ference)f(is)j(that)g(the)f(\002rst)h(function)d -(prefers)396 4333 y(hashtables)i(and)g(the)g(latter)g(associati)n(v)o -(e)g(lists)h(to)g(describe)e(mappings)g(from)g(names)h(to)g(e)o(x)o -(emplars.)396 4483 y(Y)-9 b(ou)20 b(can)g(specify)f(e)o(x)o(emplars)g -(for)g(the)i(v)n(arious)e(kinds)g(of)h(nodes)g(that)g(need)g(to)g(be)g -(generated)e(when)i(an)g(XML)396 4591 y(document)e(is)k(parsed:)p -Black 3800 5278 a Fr(58)p Black eop -%%Page: 59 59 -59 58 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black Black 396 579 a Ft(\225)p -Black 60 w Fq(~super_root_exemplar)p Fv(:)e(This)i(e)o(x)o(emplar)e(is) -j(used)f(to)h(create)f(the)g(super)f(root.)h(This)g(special)g(node)g -(is)h(only)479 687 y(created)f(if)g(the)g(corresponding)d -(con\002guration)h(option)h(has)h(been)g(selected;)g(it)h(is)g(the)f -(parent)f(node)g(of)h(the)h(root)479 795 y(node)e(which)h(may)g(be)g -(con)m(v)o(enient)d(if)k(e)n(v)o(ery)e(w)o(orking)f(node)i(must)g(ha)n -(v)o(e)f(a)i(parent.)p Black 396 903 a Ft(\225)p Black -60 w Fq(~comment_exemplar)p Fv(:)d(This)j(e)o(x)o(emplar)d(is)j(used)f -(when)f(a)i(comment)e(node)g(must)h(be)g(created.)g(Note)g(that)g(such) -479 1011 y(nodes)g(are)g(only)f(created)h(if)g(the)g(corresponding)d -(con\002guration)h(option)h(is)i("on".)p Black 396 1119 -a Ft(\225)p Black 60 w Fq(~default_pinstr_exemplar)p -Fv(:)c(If)j(a)h(node)e(for)g(a)i(processing)e(instruction)g(must)h(be)g -(created,)f(and)h(the)479 1226 y(instruction)f(is)i(not)f(listed)h(in)f -(the)g(table)h(passed)f(by)f Fq(~pinstr_mapping)g Fv(or)h -Fq(~pinstr_alist)p Fv(,)e(this)j(e)o(x)o(emplar)479 1334 -y(is)g(used.)f(Again)f(the)i(con\002guration)c(option)i(must)h(be)g -("on")g(in)g(order)f(to)i(create)e(such)h(nodes)g(at)h(all.)p -Black 396 1442 a Ft(\225)p Black 60 w Fq(~pinstr_mapping)e -Fv(or)g Fq(~pinstr_alist)p Fv(:)g(Map)h(the)g(tar)o(get)g(names)f(of)h -(processing)f(instructions)g(to)479 1550 y(e)o(x)o(emplars.)g(These)h -(mappings)e(are)i(only)g(used)g(when)f(nodes)h(for)f(processing)g -(instructions)g(are)h(created.)p Black 396 1658 a Ft(\225)p -Black 60 w Fq(~data_exemplar)p Fv(:)f(The)h(e)o(x)o(emplar)e(for)h -(ordinary)f(data)i(nodes.)p Black 396 1766 a Ft(\225)p -Black 60 w Fq(~default_element_exemplar)p Fv(:)d(This)j(e)o(x)o(emplar) -e(is)k(used)e(if)g(an)g(element)g(node)f(must)h(be)g(created,)f(b)n(ut) -i(the)479 1874 y(element)f(type)g(cannot)f(be)h(found)e(in)j(the)f -(tables)g Fq(element_mapping)e Fv(or)i Fq(element_alist)p -Fv(.)p Black 396 1982 a Ft(\225)p Black 60 w Fq(~element_mapping)e -Fv(or)i Fq(~element_alist)p Fv(:)f(Map)h(the)g(element)f(types)h(to)h -(e)o(x)o(emplars.)d(These)i(mappings)f(are)479 2090 y(used)h(to)h -(create)e(element)h(nodes.)396 2239 y(In)g(most)g(cases,)h(you)e(only)h -(w)o(ant)g(to)g(create)g Fq(spec)g Fv(v)n(alues)g(to)h(pass)f(them)g -(to)g(the)h(parser)e(functions)g(found)f(in)396 2347 -y Fq(Pxp_yacc)p Fv(.)h(Ho)n(we)n(v)o(er)m(,)f(it)j(might)f(be)g(useful) -g(to)g(apply)f Fq(spec)h Fv(v)n(alues)g(directly)-5 b(.)396 -2497 y(The)20 b(follo)n(wing)f(functions)f(create)i(v)n(arious)f(types) -h(of)g(nodes)g(by)g(selecting)f(the)i(corresponding)16 -b(e)o(x)o(emplar)j(from)g(the)396 2605 y(passed)h Fq(spec)g -Fv(v)n(alue,)g(and)f(by)h(calling)g Fq(create_element)e -Fv(or)i Fq(create_data)f Fv(on)h(the)g(e)o(x)o(emplar)-5 -b(.)396 2785 y Fq(val)45 b(create_data_node)d(:)665 2882 -y('ext)i(spec)h(->)665 2979 y(dtd)g(->)665 3076 y(\(*)g(data)f -(material:)f(*\))i(string)f(->)845 3173 y('ext)g(node)396 -3368 y(val)h(create_element_node)c(:)665 3465 y(?position:\(string)h(*) -j(int)f(*)h(int\))f(->)665 3562 y('ext)g(spec)h(->)665 -3659 y(dtd)g(->)665 3756 y(\(*)g(element)e(type:)h(*\))h(string)f(->) -665 3853 y(\(*)h(attributes:)e(*\))h(\(string)g(*)h(string\))e(list)h -(->)845 3950 y('ext)g(node)396 4145 y(val)h(create_super_root_node)c(:) -665 4242 y(?position:\(string)h(*)j(int)f(*)h(int\))f(->)665 -4339 y('ext)g(spec)h(->)710 4436 y(dtd)f(->)889 4533 -y('ext)h(node)396 4728 y(val)g(create_comment_node)c(:)665 -4825 y(?position:\(string)h(*)j(int)f(*)h(int\))f(->)p -Black 3800 5278 a Fr(59)p Black eop -%%Page: 60 60 -60 59 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 665 579 a Fq('ext)44 -b(spec)h(->)665 676 y(dtd)g(->)665 773 y(\(*)g(comment)e(text:)h(*\))h -(string)f(->)845 870 y('ext)g(node)396 1065 y(val)h(create_pinstr_node) -c(:)665 1162 y(?position:\(string)h(*)j(int)f(*)h(int\))f(->)665 -1259 y('ext)g(spec)h(->)665 1356 y(dtd)g(->)665 1453 -y(proc_instruction)d(->)845 1550 y('ext)i(node)-2 2003 -y Fp(3.2.6.)35 b(Examples)396 2171 y Fu(Building)22 b(tr)o(ees.)d -Fv(Here)h(is)h(the)g(piece)e(of)h(code)g(that)g(creates)g(the)h(tree)f -(of)g(the)g(\002gure)f Fr(A)i(tr)m(ee)g(with)f(element)g(nodes,)396 -2279 y(data)g(nodes,)f(and)g(attrib)n(utes)p Fv(.)h(The)g(e)o(xtension) -f(object)h(and)f(the)h(DTD)h(are)f(be)o(yond)e(the)i(scope)g(of)g(this) -g(e)o(xample.)396 2459 y Fq(let)45 b(exemplar_ext)d(=)j(...)f(\(*)h -(some)f(extension)f(*\))i(in)396 2556 y(let)g(dtd)f(=)h(...)f(\(*)g -(some)h(DTD)f(*\))g(in)396 2750 y(let)h(element_exemplar)d(=)i(new)h -(element_impl)e(exemplar_ext)f(in)396 2847 y(let)j(data_exemplar)177 -b(=)44 b(new)h(data_impl)178 b(exemplar_ext)42 b(in)396 -3042 y(let)j(a1)f(=)h(element_exemplar)d(#)j(cre-)396 -3139 y(ate_element)e(dtd)i(\(T_element)e("a"\))h(["att",)g("apple"])396 -3236 y(and)h(b1)f(=)h(element_exemplar)d(#)j(create_element)d(dtd)i -(\(T_element)g("b"\))g([])396 3333 y(and)h(c1)f(=)h(element_exemplar)d -(#)j(create_element)d(dtd)i(\(T_element)g("c"\))g([])396 -3430 y(and)h(a2)f(=)h(element_exemplar)d(#)j(cre-)396 -3527 y(ate_element)e(dtd)i(\(T_element)e("a"\))h(["att",)g("orange"]) -396 3624 y(in)396 3819 y(let)h(cherries)e(=)i(data_exemplar)d(#)j -(create_data)e(dtd)h("Cherries")g(in)396 3916 y(let)h(orange)133 -b(=)45 b(data_exemplar)d(#)j(create_data)e(dtd)h("An)h(orange")e(in)396 -4110 y(a1)i(#)f(add_node)g(b1;)396 4207 y(a1)h(#)f(add_node)g(c1;)396 -4304 y(b1)h(#)f(add_node)g(a2;)396 4401 y(b1)h(#)f(add_node)g -(cherries;)396 4499 y(a2)h(#)f(add_node)g(orange;)396 -4689 y Fv(Alternati)n(v)o(ely)-5 b(,)18 b(the)i(last)h(block)f(of)g -(statements)g(could)f(also)i(be)f(written)g(as:)396 4870 -y Fq(a1)45 b(#)f(set_nodes)g([b1;)g(c1];)p Black 3800 -5278 a Fr(60)p Black eop -%%Page: 61 61 -61 60 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fq(b1)45 -b(#)f(set_nodes)g([a2;)g(cherries];)396 676 y(a2)h(#)f(set_nodes)g -([orange];)396 867 y Fv(The)20 b(root)g(of)g(the)g(tree)g(is)h -Fq(a1)p Fv(,)f(i.e.)g(it)h(is)g(true)f(that)396 1047 -y Fq(x)45 b(#)g(root)f(==)g(a1)396 1238 y Fv(for)20 b(e)n(v)o(ery)f(x)h -(from)f({)i Fq(a1)p Fv(,)f Fq(a2)p Fv(,)g Fq(b1)p Fv(,)g -Fq(c1)p Fv(,)g Fq(cherries)p Fv(,)g Fq(orange)f Fv(}.)396 -1388 y(Furthermore,)f(the)i(follo)n(wing)f(properties)f(hold:)486 -1568 y Fq(a1)44 b(#)h(attribute)e("att")h(=)h(Value)f("apple")396 -1665 y(&)h(a2)f(#)h(attribute)e("att")h(=)h(Value)f("orange")396 -1859 y(&)h(cherries)e(#)i(data)f(=)h("Cherries")396 1956 -y(&)135 b(orange)43 b(#)i(data)f(=)h("An)f(orange")396 -2053 y(&)314 b(a1)44 b(#)h(data)f(=)h("CherriesAn)e(orange")396 -2248 y(&)314 b(a1)44 b(#)h(node_type)e(=)i(T_element)e("a")396 -2345 y(&)314 b(a2)44 b(#)h(node_type)e(=)i(T_element)e("a")396 -2442 y(&)314 b(b1)44 b(#)h(node_type)e(=)i(T_element)e("b")396 -2539 y(&)314 b(c1)44 b(#)h(node_type)e(=)i(T_element)e("c")396 -2636 y(&)i(cherries)e(#)i(node_type)e(=)i(T_data)396 -2733 y(&)135 b(orange)43 b(#)i(node_type)e(=)i(T_data)396 -2928 y(&)314 b(a1)44 b(#)h(sub_nodes)e(=)i([)g(b1;)f(c1)h(])396 -3025 y(&)314 b(a2)44 b(#)h(sub_nodes)e(=)i([)g(orange)f(])396 -3122 y(&)314 b(b1)44 b(#)h(sub_nodes)e(=)i([)g(a2;)f(cherries)g(])396 -3219 y(&)314 b(c1)44 b(#)h(sub_nodes)e(=)i([])396 3316 -y(&)g(cherries)e(#)i(sub_nodes)e(=)i([])396 3413 y(&)135 -b(orange)43 b(#)i(sub_nodes)e(=)i([])396 3608 y(&)314 -b(a2)44 b(#)h(parent)f(==)g(a1)396 3705 y(&)314 b(b1)44 -b(#)h(parent)f(==)g(b1)396 3802 y(&)314 b(c1)44 b(#)h(parent)f(==)g(a1) -396 3899 y(&)h(cherries)e(#)i(parent)f(==)g(b1)396 3996 -y(&)135 b(orange)43 b(#)i(parent)f(==)g(a2)396 4229 y -Fu(Sear)o(ching)19 b(nodes.)g Fv(The)g(follo)n(wing)e(function)h -(searches)h(all)g(nodes)g(of)g(a)g(tree)h(for)e(which)h(a)g(certain)g -(condition)e(holds:)396 4409 y Fq(let)45 b(rec)f(search)g(p)g(t)h(=)486 -4506 y(if)f(p)h(t)g(then)576 4603 y(t)f(::)h(search_list)e(p)h(\(t)h(#) -g(sub_nodes\))486 4700 y(else)576 4797 y(search_list)e(p)h(\(t)h(#)f -(sub_nodes\))p Black 3800 5278 a Fr(61)p Black eop -%%Page: 62 62 -62 61 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 676 a Fq(and)45 -b(search_list)e(p)h(l)h(=)486 773 y(match)f(l)h(with)576 -870 y([])268 b(-)p Fo(>)45 b Fq([])486 967 y(|)g(t)f(::)h(l')f(-)p -Fo(>)h Fq(\(search)e(p)i(t\))f(@)h(\(search_list)e(p)i(l'\))396 -1065 y(;;)396 1297 y Fv(F)o(or)20 b(e)o(xample,)f(if)h(you)f(w)o(ant)i -(to)f(search)g(all)h(elements)f(of)f(a)i(certain)f(type)f -Fq(et)p Fv(,)i(the)f(function)e Fq(search)i Fv(can)g(be)g(applied)396 -1405 y(as)h(follo)n(ws:)396 1585 y Fq(let)45 b(search_element_type)c -(et)k(t)f(=)486 1682 y(search)g(\(fun)g(x)h(-)p Fo(>)f -Fq(x)h(#)f(node_type)g(=)g(T_element)g(et\))g(t)396 1779 -y(;;)396 2012 y Fu(Getting)20 b(attrib)n(ute)f(v)o(alues.)h -Fv(Suppose)f(we)i(ha)n(v)o(e)f(the)g(declaration:)396 -2192 y Fq()396 -2577 y Fv(In)20 b(this)h(case,)f(e)n(v)o(ery)f(element)h -Fq(e)g Fv(must)h(ha)n(v)o(e)e(an)h(attrib)n(ute)g Fq(a)p -Fv(,)g(otherwise)g(the)g(parser)g(w)o(ould)f(indicate)h(an)g(error)-5 -b(.)19 b(If)h(the)396 2685 y(O'Caml)h(v)n(ariable)e Fq(n)h -Fv(holds)g(the)g(node)f(of)h(the)g(tree)h(corresponding)16 -b(to)21 b(the)f(element,)f(you)g(can)h(get)h(the)f(v)n(alue)f(of)h(the) -396 2793 y(attrib)n(ute)g Fq(a)h Fv(by)396 2973 y Fq(let)45 -b(value_of_a)e(=)h(n)h(#)g(required_string_attribute)40 -b("a")396 3164 y Fv(which)20 b(is)h(more)e(or)h(less)i(an)e(abbre)n -(viation)d(for)396 3344 y Fq(let)45 b(value_of_a)e(=)486 -3442 y(match)h(n)h(#)f(attribute)g("a")g(with)576 3539 -y(Value)g(s)g(->)h(s)486 3636 y(|)g(_)313 b(->)45 b(assert)f(false)396 -3827 y Fv(-)21 b(as)g(the)f(attrib)n(ute)g(is)h(required,)d(the)i -Fq(attribute)f Fv(method)g(al)o(w)o(ays)i(returns)e(a)i -Fq(Value)p Fv(.)396 3976 y(In)f(contrast)g(to)g(this,)h(the)f(attrib)n -(ute)g Fq(b)g Fv(can)g(be)g(omitted.)g(In)f(this)i(case,)g(the)f -(method)396 4084 y Fq(required_string_attribute)d Fv(w)o(orks)j(only)f -(if)h(the)h(attrib)n(ute)f(is)h(there,)e(and)h(the)g(method)f(will)i(f) -o(ail)f(if)h(the)396 4192 y(attrib)n(ute)f(is)h(missing.)f(T)-7 -b(o)20 b(get)h(the)f(v)n(alue,)f(you)g(can)h(apply)g(the)g(method)f -Fq(optional_string_attribute)p Fv(:)396 4372 y Fq(let)45 -b(value_of_b)e(=)h(n)h(#)g(optional_string_attribute)40 -b("b")396 4563 y Fv(No)n(w)-5 b(,)20 b Fq(value_of_b)f -Fv(is)i(of)f(type)g Fq(string)43 b(option)p Fv(,)20 b(and)f -Fq(None)i Fv(represents)e(the)h(omitted)g(attrib)n(ute.)f(Alternati)n -(v)o(ely)-5 b(,)396 4671 y(you)20 b(could)f(also)h(use)h -Fq(attribute)p Fv(:)396 4851 y Fq(let)45 b(value_of_b)e(=)p -Black 3800 5278 a Fr(62)p Black eop -%%Page: 63 63 -63 62 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 486 579 a Fq(match)44 -b(n)h(#)f(attribute)g("b")g(with)576 676 y(Value)g(s)313 -b(->)45 b(Some)f(s)486 773 y(|)h(Implied_value)d(->)j(None)486 -870 y(|)g(_)582 b(->)45 b(assert)f(false)396 1103 y Fv(The)20 -b(attrib)n(ute)g Fq(c)h Fv(beha)n(v)o(es)e(much)g(lik)o(e)h -Fq(a)p Fv(,)h(because)e(it)i(has)g(al)o(w)o(ays)f(a)h(v)n(alue.)e(If)h -(the)g(attrib)n(ute)g(is)h(omitted,)f(the)g(def)o(ault,)396 -1211 y(here)g("12345",)e(will)j(be)f(returned)e(instead.)i(Because)g -(of)g(this,)h(you)e(can)h(again)f(use)396 1319 y Fq -(required_string_attribute)e Fv(to)j(get)g(the)h(v)n(alue.)396 -1468 y(The)f(type)g Fq(CDATA)g Fv(is)h(the)f(most)g(general)f(string)h -(type.)g(The)g(types)g Fq(NMTOKEN)p Fv(,)f Fq(ID)p Fv(,)h -Fq(IDREF)p Fv(,)g Fq(ENTITY)p Fv(,)f(and)h(all)396 1576 -y(enumerators)e(and)i(notations)f(are)h(special)h(forms)e(of)h(string)g -(types)g(that)g(restrict)g(the)h(possible)f(v)n(alues.)f(From)396 -1684 y(O'Caml,)h(the)o(y)g(beha)n(v)o(e)f(lik)o(e)h Fq(CDATA)p -Fv(,)g(i.e.)g(you)f(can)h(use)h(the)f(methods)f Fq -(required_string_attribute)e Fv(and)396 1792 y Fq -(optional_string_attribute)p Fv(,)g(too.)396 1941 y(In)j(contrast)g(to) -g(this,)h(the)f(types)g Fq(NMTOKENS)p Fv(,)f Fq(IDREFS)p -Fv(,)g(and)h Fq(ENTITIES)g Fv(mean)f(lists)j(of)e(strings.)g(Suppose)f -(we)h(ha)n(v)o(e)396 2049 y(the)g(declaration:)396 2229 -y Fq()396 2517 y Fv(The)20 -b(type)g Fq(NMTOKENS)f Fv(stands)i(for)e(lists)j(of)e(space-separated)e -(tok)o(ens;)i(for)f(e)o(xample)g(the)h(v)n(alue)g Fq("1)44 -b(abc)h(23ef")396 2625 y Fv(means)20 b(the)g(list)i Fq(["1";)44 -b("abc";)f("23ef"])p Fv(.)20 b(\(Again,)e Fq(IDREFS)i -Fv(and)g Fq(ENTITIES)f Fv(ha)n(v)o(e)h(more)f(restricted)h(v)n -(alues.\))396 2733 y(T)-7 b(o)21 b(get)f(the)g(v)n(alue)g(of)f(attrib)n -(ute)h Fq(d)p Fv(,)h(one)e(can)h(use)396 2913 y Fq(let)45 -b(value_of_d)e(=)h(n)h(#)g(required_list_attribute)c("d")396 -3104 y Fv(or)396 3285 y Fq(let)k(value_of_d)e(=)486 3382 -y(match)h(n)h(#)f(attribute)g("d")g(with)576 3479 y(Valuelist)f(l)i(->) -f(l)486 3576 y(|)h(_)493 b(->)44 b(assert)g(false)396 -3767 y Fv(As)21 b Fq(d)g Fv(is)g(required,)d(the)i(attrib)n(ute)g -(cannot)f(be)h(omitted,)g(and)f(the)h Fq(attribute)g -Fv(method)e(returns)i(al)o(w)o(ays)g(a)396 3875 y Fq(Valuelist)p -Fv(.)396 4024 y(F)o(or)g(optional)f(attrib)n(utes)h(lik)o(e)h -Fq(e)p Fv(,)f(apply)396 4204 y Fq(let)45 b(value_of_e)e(=)h(n)h(#)g -(optional_list_attribute)c("e")396 4395 y Fv(or)396 4576 -y Fq(let)k(value_of_e)e(=)486 4673 y(match)h(n)h(#)f(attribute)g("e")g -(with)576 4770 y(Valuelist)f(l)134 b(->)45 b(l)486 4867 -y(|)g(Implied_value)d(->)j([])p Black 3800 5278 a Fr(63)p -Black eop -%%Page: 64 64 -64 63 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 486 579 a Fq(|)45 -b(_)582 b(->)45 b(assert)f(false)396 770 y Fv(Here,)20 -b(the)g(case)h(that)f(the)g(attrib)n(ute)g(is)h(missing)f(counts)g(lik) -o(e)g(the)h(empty)e(list.)-2 1139 y Fp(3.2.7.)35 b(Iterator)n(s)396 -1307 y Fv(There)20 b(are)g(also)g(se)n(v)o(eral)g(iterators)g(in)g -(Pxp_document;)d(please)j(see)h(the)f(mli)h(\002le)f(for)g(details.)g -(Y)-9 b(ou)20 b(can)g(\002nd)396 1415 y(e)o(xamples)f(for)h(them)g(in)g -(the)g("simple_transformation")d(directory)-5 b(.)396 -1595 y Fq(val)45 b(find)f(:)g(?deeply:bool)f(->)889 1692 -y(f:\('ext)h(node)g(->)h(bool\))f(->)g('ext)g(node)h(->)f('ext)g(node) -396 1887 y(val)h(find_all)e(:)i(?deeply:bool)e(->)1069 -1984 y(f:\('ext)g(node)i(->)f(bool\))g(->)h('ext)f(node)g(->)g('ext)h -(node)f(list)396 2178 y(val)h(find_element)d(:)j(?deeply:bool)e(->)1248 -2275 y(string)h(->)g('ext)h(node)f(->)g('ext)g(node)396 -2469 y(val)h(find_all_elements)d(:)i(?deeply:bool)f(->)1472 -2567 y(string)h(->)h('ext)f(node)g(->)g('ext)h(node)f(list)396 -2761 y(exception)g(Skip)396 2858 y(val)h(map_tree)e(:)90 -b(pre:\('exta)43 b(node)h(->)g('extb)g(node\))g(->)1069 -2955 y(?post:\('extb)f(node)h(->)g('extb)g(node\))g(->)1069 -3052 y('exta)g(node)g(->)1248 3149 y('extb)g(node)396 -3441 y(val)h(map_tree_sibl)d(:)755 3538 y(pre:)i(\('exta)g(node)g -(option)g(->)g('exta)g(node)h(->)f('exta)g(node)g(option)g(->)1203 -3635 y('extb)g(node\))g(->)710 3732 y(?post:\('extb)f(node)h(option)g -(->)g('extb)g(node)h(->)f('extb)g(node)g(option)g(->)1203 -3829 y('extb)g(node\))g(->)710 3927 y('exta)g(node)g(->)889 -4024 y('extb)g(node)396 4218 y(val)h(iter_tree)e(:)i(?pre:\('ext)e -(node)h(->)g(unit\))g(->)1114 4315 y(?post:\('ext)f(node)h(->)g(unit\)) -g(->)1114 4412 y('ext)g(node)g(->)1293 4509 y(unit)396 -4704 y(val)h(iter_tree_sibl)d(:)710 4801 y(?pre:)i(\('ext)g(node)g -(option)g(->)h('ext)f(node)g(->)g('ext)h(node)f(option)g(->)g(unit\))g -(->)p Black 3800 5278 a Fr(64)p Black eop -%%Page: 65 65 -65 64 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 710 579 a Fq(?post:\('ext)43 -b(node)h(option)g(->)h('ext)f(node)g(->)g('ext)h(node)f(option)g(->)g -(unit\))g(->)710 676 y('ext)g(node)g(->)889 773 y(unit)-2 -1358 y Fx(3.3.)39 b(The)g(c)m(lass)g(type)g Fb(extension)396 -1610 y Fq(class)44 b(type)g([)h('node)f(])h(extension)e(=)486 -1707 y(object)h(\('self\))576 1804 y(method)f(clone)h(:)h('self)665 -1901 y(\(*)g("clone")e(should)h(return)g(an)h(exact)f(deep)g(copy)g(of) -g(the)h(object.)e(*\))576 1998 y(method)g(node)i(:)f('node)665 -2095 y(\(*)h("node")f(returns)f(the)i(corresponding)d(node)i(of)h(this) -f(extension.)f(This)h(method)710 2193 y(*)h(intended)e(to)i(return)f -(exactly)f(what)h(previ-)396 2290 y(ously)g(has)h(been)f(set)g(by)h -("set_node".)710 2387 y(*\))576 2484 y(method)e(set_node)h(:)h('node)f -(->)g(unit)665 2581 y(\(*)h("set_node")e(is)h(invoked)g(once)g(the)h -(extension)e(is)h(associated)g(to)g(a)h(new)710 2678 -y(*)g(node)f(object.)710 2775 y(*\))486 2873 y(end)396 -3063 y Fv(This)21 b(is)g(the)f(type)g(of)g(classes)h(used)f(for)f(node) -h(e)o(xtensions.)e(F)o(or)i(e)n(v)o(ery)f(node)g(of)h(the)g(document)e -(tree,)i(there)g(is)h(not)396 3171 y(only)f(the)g Fq(node)g -Fv(object,)f(b)n(ut)h(also)g(an)g Fq(extension)f Fv(object.)h(The)f -(latter)i(has)f(minimal)f(functionality;)f(it)j(has)f(only)g(the)396 -3279 y(necessary)g(methods)f(to)h(be)g(attached)g(to)g(the)g(node)f -(object)h(containing)e(the)j(details)f(of)g(the)g(node)f(instance.)h -(The)396 3387 y(e)o(xtension)f(object)h(is)h(called)f(e)o(xtension)f -(because)g(its)i(purpose)e(is)i(e)o(xtensibility)-5 b(.)396 -3537 y(F)o(or)20 b(some)g(reasons,)g(it)h(is)g(impossible)e(to)i(deri)n -(v)o(e)d(the)j Fq(node)f Fv(classes)h(\(i.e.)f Fq(element_impl)f -Fv(and)g Fq(data_impl)p Fv(\))g(such)396 3645 y(that)i(the)f -(subclasses)g(can)g(be)g(e)o(xtended)f(by)g(ne)n(w)h(ne)n(w)g(methods.) -f(But)i(subclassing)f(nodes)f(is)i(a)g(great)f(feature,)396 -3753 y(because)g(it)h(allo)n(ws)f(the)g(user)g(to)h(pro)o(vide)d(dif)n -(ferent)g(classes)k(for)d(dif)n(ferent)g(types)h(of)g(nodes.)f(The)h(e) -o(xtension)f(objects)396 3860 y(are)h(a)h(w)o(orkaround)c(that)j(is)i -(as)e(po)n(werful)f(as)i(direct)f(subclassing,)f(the)h(costs)h(are)f -(some)g(notation)f(o)o(v)o(erhead.)p Black 3800 5278 -a Fr(65)p Black eop -%%Page: 66 66 -66 65 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fu(Figur)o(e)g(3-6.)f -(The)i(structur)o(e)f(of)g(nodes)g(and)h(extensions)396 -1928 y - currentpoint currentpoint translate 1 1 scale neg exch neg exch translate - 396 1928 a @beginspecial 0 @llx 0 @lly 206 @urx -140 @ury 2060 @rwi @setspecial -%%BeginDocument: pic/extension_general.ps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: src/pic/extension_general.fig -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Sun Aug 27 02:05:42 2000 -%%For: gerd@ice (Gerd Stolpmann) -%%Orientation: Portrait -%%BoundingBox: 0 0 206 140 -%%Pages: 0 -%%BeginSetup -%%EndSetup -%%Magnification: 0.8000 -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save --22.0 205.0 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 5050 m -1000 -1000 l 5514 -1000 l 5514 5050 l cp clip - 0.05039 0.05039 sc -7.500 slw -% Ellipse -n 1575 2250 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 1575 3375 225 225 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 675 3375 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 2475 3375 229 229 0 360 DrawEllipse gs col7 0.75 shd ef gr gs col0 s gr - -% Ellipse -n 3600 2475 180 180 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 2880 2475 180 180 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 4320 2475 186 186 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Ellipse -n 3600 1485 186 186 0 360 DrawEllipse gs col7 0.50 shd ef gr gs col0 s gr - -% Polyline -n 675 3150 m 1395 2385 l gs col0 s gr -% Polyline -n 1575 2475 m 1575 3150 l gs col0 s gr -% Polyline -n 1755 2385 m 2475 3150 l gs col0 s gr -% Polyline - [60] 0 sd -gs clippath -3288 1467 m 3412 1462 l 3305 1524 l 3435 1487 l 3418 1429 l cp -clip -n 1537 2010 m 3412 1462 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 3288 1467 m 3412 1462 l 3305 1524 l col0 s -% Polyline - [60] 0 sd -gs clippath -1796 2042 m 1672 2047 l 1779 1984 l 1649 2022 l 1666 2080 l cp -clip -n 3412 1537 m 1672 2047 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 1796 2042 m 1672 2047 l 1779 1984 l col0 s -% Polyline - [60] 0 sd -gs clippath -2584 2524 m 2707 2512 l 2604 2581 l 2731 2535 l 2711 2479 l cp -933 3183 m 810 3195 l 913 3126 l 786 3172 l 806 3228 l cp -clip -n 810 3195 m 2707 2512 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 933 3183 m 810 3195 l 913 3126 l col0 s -% arrowhead -n 2584 2524 m 2707 2512 l 2604 2581 l col0 s -% Polyline - [60] 0 sd -gs clippath -3319 2594 m 3442 2580 l 3340 2650 l 3467 2603 l 3446 2547 l cp -1863 3203 m 1740 3217 l 1842 3147 l 1715 3194 l 1736 3250 l cp -clip -n 1740 3217 m 3442 2580 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 1863 3203 m 1740 3217 l 1842 3147 l col0 s -% arrowhead -n 3319 2594 m 3442 2580 l 3340 2650 l col0 s -% Polyline - [60] 0 sd -gs clippath -4054 2626 m 4177 2610 l 4076 2682 l 4202 2632 l 4180 2577 l cp -2763 3194 m 2640 3210 l 2741 3138 l 2615 3188 l 2637 3243 l cp -clip -n 2640 3210 m 4177 2610 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 2763 3194 m 2640 3210 l 2741 3138 l col0 s -% arrowhead -n 4054 2626 m 4177 2610 l 4076 2682 l col0 s -/Courier-Bold ff 180.00 scf sf -3555 1530 m -gs 1 -1 sc (x) col0 sh gr -/Courier-Bold ff 180.00 scf sf -1530 2295 m -gs 1 -1 sc (n) col0 sh gr -/Courier ff 180.00 scf sf -1658 1950 m -gs 1 -1 sc 17.0 rot (n # extension) col0 sh gr -/Courier ff 180.00 scf sf -2475 1950 m -gs 1 -1 sc 17.0 rot (x # node) col0 sh gr -/Helvetica ff 180.00 scf sf -1020 4050 m -gs 1 -1 sc (The node tree) col0 sh gr -/Helvetica ff 180.00 scf sf -3225 3285 m -gs 1 -1 sc (The extensions) col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 396 1928 a - currentpoint currentpoint translate 1 1 div 1 1 div scale neg exch -neg exch translate - 396 1928 a 357 x Fv(The)f(picture)f(sho)n(ws)i -(ho)n(w)e(the)i(nodes)e(and)h(e)o(xtensions)f(are)h(link)o(ed)f -(together)-5 b(.)19 b(Ev)o(ery)g(node)g(has)i(a)f(reference)f(to)h(its) -396 2393 y(e)o(xtension,)f(and)g(e)n(v)o(ery)g(e)o(xtension)g(has)h(a)h -(reference)d(to)j(its)g(node.)e(The)h(methods)f Fq(extension)g -Fv(and)h Fq(node)g Fv(follo)n(w)396 2501 y(these)h(references;)e(a)h -(typical)g(phrase)f(is)396 2681 y Fq(self)44 b(#)h(node)f(#)h -(attribute)e("xy")396 2872 y Fv(to)21 b(get)f(the)g(v)n(alue)g(of)f(an) -i(attrib)n(ute)e(from)h(a)g(method)f(de\002ned)g(in)h(the)h(e)o -(xtension)d(object;)i(or)396 3053 y Fq(self)44 b(#)h(node)f(#)h(iter) -486 3150 y(\(fun)f(n)h(-)p Fo(>)f Fq(n)h(#)f(extension)g(#)g(my_method) -g(...\))396 3341 y Fv(to)21 b(iterate)f(o)o(v)o(er)f(the)h(subnodes)f -(and)g(to)i(call)f Fq(my_method)f Fv(of)h(the)h(corresponding)16 -b(e)o(xtension)j(objects.)396 3490 y(Note)h(that)h(e)o(xtension)d -(objects)i(do)g(not)g(ha)n(v)o(e)g(references)e(to)j(subnodes)e(\(or)g -("sube)o(xtensions"\))f(themselv)o(es;)h(in)i(order)396 -3598 y(to)g(get)f(one)f(of)h(the)h(children)d(of)i(an)g(e)o(xtension)f -(you)g(must)i(\002rst)g(go)e(to)i(the)f(node)f(object,)h(then)f(get)h -(the)h(child)e(node,)396 3706 y(and)h(\002nally)g(reach)f(the)i(e)o -(xtension)d(that)j(is)g(logically)e(the)h(child)g(of)g(the)g(e)o -(xtension)f(you)g(started)h(with.)-2 4034 y Fp(3.3.1.)35 -b(Ho)n(w)f(to)f(de\002ne)h(an)g(e)n(xtension)i(c)n(lass)396 -4202 y Fv(At)21 b(minimum,)e(you)g(must)h(de\002ne)g(the)g(methods)f -Fq(clone)p Fv(,)h Fq(node)p Fv(,)g(and)f Fq(set_node)h -Fv(such)f(that)i(your)e(class)i(is)396 4310 y(compatible)e(with)h(the)h -(type)e Fq(extension)p Fv(.)g(The)h(method)f Fq(set_node)g -Fv(is)i(called)f(during)f(the)h(initialization)g(of)g(the)396 -4418 y(node,)f(or)h(after)g(a)h(node)e(has)h(been)g(cloned;)f(the)h -(node)f(object)h(in)m(v)n(ok)o(es)f Fq(set_node)g Fv(on)h(the)g(e)o -(xtension)f(object)h(to)g(tell)396 4526 y(it)h(that)f(this)h(node)e(is) -i(no)n(w)f(the)g(object)g(the)g(e)o(xtension)f(is)i(link)o(ed)f(to.)g -(The)f(e)o(xtension)g(must)h(return)f(the)i(node)e(object)396 -4633 y(passed)h(as)h(ar)o(gument)d(of)i Fq(set_node)f -Fv(when)h(the)g Fq(node)g Fv(method)f(is)i(called.)p -Black 3798 5278 a Fr(66)p Black eop -%%Page: 67 67 -67 66 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fv(The)g -Fq(clone)g Fv(method)f(must)h(return)f(a)i(cop)o(y)e(of)h(the)g(e)o -(xtension)f(object;)h(at)g(least)h(the)f(object)g(itself)h(must)f(be) -396 687 y(duplicated,)f(b)n(ut)h(if)g(required,)e(the)j(cop)o(y)e -(should)g(deeply)g(duplicate)g(all)i(objects)f(and)g(v)n(alues)g(that)g -(are)g(referred)e(by)396 795 y(the)i(e)o(xtension,)f(too.)h(Whether)f -(this)i(is)g(required,)d(depends)h(on)h(the)g(application;)f -Fq(clone)h Fv(is)h(in)m(v)n(ok)o(ed)d(by)i(the)g(node)396 -903 y(object)g(when)g(one)f(of)h(its)h(cloning)e(methods)g(is)i -(called.)396 1052 y(A)g(good)e(starting)h(point)f(for)h(an)g(e)o -(xtension)e(class:)396 1232 y Fq(class)44 b(custom_extension)e(=)486 -1329 y(object)i(\(self\))576 1524 y(val)g(mutable)g(node)g(=)g(\(None)g -(:)h(custom_extension)d(node)i(option\))576 1718 y(method)f(clone)h(=)h -({<)g(>})576 1912 y(method)e(node)i(=)665 2009 y(match)f(node)g(with) -845 2107 y(None)g(->)934 2204 y(assert)g(false)755 2301 -y(|)h(Some)f(n)g(->)h(n)576 2495 y(method)e(set_node)h(n)h(=)665 -2592 y(node)f(<-)h(Some)f(n)486 2786 y(end)396 2977 y -Fv(This)21 b(class)g(is)g(compatible)e(with)h Fq(extension)p -Fv(.)f(The)h(purpose)e(of)i(de\002ning)f(such)h(a)h(class)g(is,)g(of)f -(course,)f(adding)396 3085 y(further)g(methods;)g(and)h(you)f(can)h(do) -g(it)h(without)e(restriction.)396 3235 y(Often,)h(you)f(w)o(ant)h(not)g -(only)g(one)f(e)o(xtension)g(class.)i(In)f(this)h(case,)f(it)h(is)g -(the)f(simplest)h(w)o(ay)f(that)g(all)h(your)e(classes)i(\(for)396 -3343 y(one)f(kind)f(of)h(document\))e(ha)n(v)o(e)i(the)g(same)g(type)g -(\(with)g(respect)g(to)g(the)g(interf)o(ace;)g(i.e.)g(it)h(does)f(not)g -(matter)g(if)g(your)396 3451 y(classes)i(dif)n(fer)d(in)h(the)g -(de\002ned)f(pri)n(v)n(ate)h(methods)f(and)g(instance)h(v)n(ariables,)f -(b)n(ut)h(public)g(methods)f(count\).)f(This)396 3559 -y(approach)g(a)n(v)n(oids)i(lots)h(of)f(coercions)f(and)h(problems)e -(with)j(type)f(incompatibilities.)e(It)j(is)g(simple)f(to)g(implement:) -396 3739 y Fq(class)44 b(custom_extension)e(=)486 3836 -y(object)i(\(self\))576 3933 y(val)g(mutable)g(node)g(=)g(\(None)g(:)h -(custom_extension)d(node)i(option\))576 4127 y(method)f(clone)h(=)h -(...)269 b(\(*)44 b(see)g(above)g(*\))576 4224 y(method)f(node)i(=)f -(...)314 b(\(*)44 b(see)g(above)g(*\))576 4322 y(method)f(set_node)h(n) -h(=)f(...)h(\(*)f(see)g(above)g(*\))576 4516 y(method)f(virtual)h -(my_method1)f(:)i(...)576 4613 y(method)e(virtual)h(my_method2)f(:)i -(...)576 4710 y(...)f(\(*)g(etc.)h(*\))486 4807 y(end)p -Black 3797 5278 a Fr(67)p Black eop -%%Page: 68 68 -68 67 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 676 a Fq(class)44 -b(custom_extension_kind_A)d(=)486 773 y(object)j(\(self\))576 -870 y(inherit)f(custom_extension)576 1065 y(method)g(my_method1)h(=)g -(...)576 1162 y(method)f(my_method2)h(=)g(...)486 1259 -y(end)396 1453 y(class)g(custom_extension_kind_B)d(=)486 -1550 y(object)j(\(self\))576 1647 y(inherit)f(custom_extension)576 -1842 y(method)g(my_method1)h(=)g(...)576 1939 y(method)f(my_method2)h -(=)g(...)486 2036 y(end)396 2227 y Fv(If)20 b(a)h(class)g(does)f(not)g -(need)f(a)i(method)e(\(e.g.)g(because)h(it)h(does)e(not)h(mak)o(e)g -(sense,)g(or)g(it)h(w)o(ould)f(violate)f(some)396 2335 -y(important)g(condition\),)f(it)j(is)g(possible)f(to)g(de\002ne)g(the)g -(method)f(and)g(to)i(al)o(w)o(ays)f(raise)h(an)f(e)o(xception)e(when)i -(the)396 2443 y(method)f(is)i(in)m(v)n(ok)o(ed)e(\(e.g.)g -Fq(assert)44 b(false)p Fv(\).)396 2592 y(The)20 b(latter)g(is)i(a)e -(strong)g(recommendation:)c(do)k(not)g(try)g(to)g(further)f(specialize) -h(the)g(types)g(of)g(e)o(xtension)f(objects.)h(It)g(is)396 -2700 y(dif)n(\002cult,)g(sometimes)g(e)n(v)o(en)f(impossible,)g(and)h -(almost)g(ne)n(v)o(er)f(w)o(orth-while.)-2 3070 y Fp(3.3.2.)35 -b(Ho)n(w)f(to)f(bind)h(e)n(xtension)h(c)n(lasses)h(to)d(element)i -(types)396 3237 y Fv(Once)20 b(you)f(ha)n(v)o(e)h(de\002ned)f(your)g(e) -o(xtension)g(classes,)i(you)e(can)h(bind)g(them)f(to)i(element)e -(types.)h(The)g(simplest)h(case)f(is)396 3345 y(that)h(you)e(ha)n(v)o -(e)g(only)h(one)f(class)j(and)d(that)i(this)f(class)h(is)h(to)e(be)g -(al)o(w)o(ays)h(used.)e(The)h(parsing)f(functions)g(in)h(the)h(module) -396 3453 y Fq(Pxp_yacc)f Fv(tak)o(e)g(a)h Fq(spec)f Fv(ar)o(gument)d -(which)j(can)g(be)g(customized.)f(If)h(your)f(single)h(class)h(has)g -(the)f(name)f Fq(c)p Fv(,)i(this)396 3561 y(ar)o(gument)d(should)h(be) -396 3741 y Fq(let)45 b(spec)f(=)486 3839 y(make_spec_from_alist)576 -3936 y(~data_exemplar:)535 b(\(new)44 b(data_impl)g(c\))576 -4033 y(~default_element_exemplar:)c(\(new)k(element_impl)f(c\))576 -4130 y(~element_alist:)535 b([])576 4227 y(\(\))396 4418 -y Fv(This)21 b(means)f(that)g(data)g(nodes)f(will)i(be)f(created)g -(from)f(the)h(e)o(x)o(emplar)e(passed)i(by)g(~data_e)o(x)o(emplar)d -(and)j(that)g(all)396 4526 y(element)g(nodes)f(will)i(be)f(made)g(from) -f(the)h(e)o(x)o(emplar)e(speci\002ed)i(by)g(~def)o(ault_element_e)o(x)o -(emplar)-5 b(.)15 b(In)396 4634 y(~element_alist,)k(you)h(can)g(pass)g -(that)h(dif)n(ferent)d(e)o(x)o(emplars)h(are)h(to)g(be)g(used)g(for)g -(dif)n(ferent)e(element)i(types;)g(b)n(ut)g(this)396 -4742 y(is)h(an)g(optional)d(feature.)h(If)h(you)g(do)g(not)f(need)h -(it,)h(pass)f(the)g(empty)g(list.)p Black 3800 5278 a -Fr(68)p Black eop -%%Page: 69 69 -69 68 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fv(Remember)f(that)i(an)f -(e)o(x)o(emplar)e(is)j(a)g(\(node,)d(e)o(xtension\))h(pair)g(that)i -(serv)o(es)f(as)h(pattern)e(when)h(ne)n(w)g(nodes)f(\(and)g(the)396 -687 y(corresponding)e(e)o(xtension)i(objects\))g(are)h(added)f(to)i -(the)f(document)e(tree.)i(In)g(this)h(case,)f(the)g(e)o(x)o(emplar)f -(contains)g Fq(c)i Fv(as)396 795 y(e)o(xtension,)e(and)g(when)h(nodes)f -(are)i(created,)e(the)h(e)o(x)o(emplar)e(is)j(cloned,)e(and)h(cloning)f -(mak)o(es)h(also)g(a)h(cop)o(y)e(of)h Fq(c)h Fv(such)396 -903 y(that)g(all)f(nodes)g(of)g(the)g(document)e(tree)i(will)h(ha)n(v)o -(e)f(a)g(cop)o(y)g(of)g Fq(c)g Fv(as)h(e)o(xtension.)396 -1052 y(The)f Fq(~element_alist)f Fv(ar)o(gument)e(can)j(bind)g -(speci\002c)g(element)g(types)g(to)g(speci\002c)g(e)o(x)o(emplars;)f -(as)i(e)o(x)o(emplars)396 1160 y(may)f(be)g(instances)g(of)g(dif)n -(ferent)f(classes)i(it)g(is)g(ef)n(fecti)n(v)o(ely)d(possible)i(to)h -(bind)e(element)h(types)g(to)g(classes.)h(F)o(or)396 -1268 y(e)o(xample,)e(if)h(the)g(element)g(type)g("p")g(is)h -(implemented)d(by)i(class)h("c_p",)e(and)h("q")g(is)h(realized)f(by)f -("c_q",)h(you)f(can)396 1376 y(pass)i(the)f(follo)n(wing)f(v)n(alue:) -396 1556 y Fq(let)45 b(spec)f(=)486 1653 y(make_spec_from_alist)576 -1750 y(~data_exemplar:)535 b(\(new)44 b(data_impl)g(c\))576 -1847 y(~default_element_exemplar:)c(\(new)k(element_impl)f(c\))576 -1945 y(~element_alist:)665 2042 y([)i("p",)f(new)g(element_impl)f(c_p;) -755 2139 y("q",)h(new)g(element_impl)f(c_q;)665 2236 -y(])576 2333 y(\(\))396 2524 y Fv(The)20 b(e)o(xtension)f(object)h -Fq(c)g Fv(is)h(still)h(used)e(for)f(all)i(data)f(nodes)f(and)h(for)g -(all)g(other)g(element)f(types.)-2 3026 y Fx(3.4.)39 -b(Details)f(of)i(the)f(mapping)e(fr)m(om)i(XML)g(te)n(xt)g(to)g(the)g -(tree)-2 3212 y(representation)-2 3540 y Fp(3.4.1.)c(The)f -(representation)h(of)e(c)o(haracter)n(-free)h(elements)396 -3708 y Fv(If)20 b(an)g(element)g(declaration)f(does)h(not)f(allo)n(w)i -(the)f(element)f(to)i(contain)e(character)g(data,)h(the)g(follo)n(wing) -e(rules)j(apply)-5 b(.)396 3858 y(If)20 b(the)h(element)e(must)h(be)g -(empty)-5 b(,)19 b(i.e.)h(it)h(is)g(declared)e(with)i(the)f(k)o(e)o(yw) -o(ord)e Fq(EMPTY)p Fv(,)i(the)g(element)g(instance)g(must)g(be)396 -3965 y(ef)n(fecti)n(v)o(ely)f(empty)g(\(it)h(must)h(not)f(e)n(v)o(en)f -(contain)g(whitespace)h(characters\).)e(The)i(parser)g(guarantees)e -(that)j(a)f(declared)396 4073 y Fq(EMPTY)g Fv(element)g(does)g(ne)n(v)o -(er)f(contain)g(a)h(data)g(node,)f(e)n(v)o(en)g(if)i(the)f(data)g(node) -f(represents)h(the)g(empty)f(string.)396 4223 y(If)h(the)h(element)e -(declaration)g(only)g(permits)h(other)f(elements)h(to)h(occur)e(within) -h(that)g(element)g(b)n(ut)g(not)g(character)396 4331 -y(data,)g(it)h(is)g(still)g(possible)f(to)h(insert)f(whitespace)g -(characters)f(between)g(the)h(subelements.)f(The)h(parser)g(ignores)f -(these)396 4439 y(characters,)g(too,)h(and)g(does)f(not)h(create)g -(data)g(nodes)g(for)f(them.)396 4588 y Fu(Example.)h -Fv(Consider)g(the)g(follo)n(wing)f(element)g(types:)396 -4768 y Fq()396 -4865 y()p Black 3800 -5278 a Fr(69)p Black eop -%%Page: 70 70 -70 69 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fq()396 770 y Fv(Only)20 b Fq(x)h Fv(may)e(contain)h -(character)e(data,)i(the)h(k)o(e)o(yw)o(ord)d Fq(#PCDATA)h -Fv(indicates)h(this.)h(The)f(other)f(types)h(are)396 -878 y(character)n(-free.)396 1027 y(The)g(XML)g(term)396 -1207 y Fq()44 b()396 1398 y Fv(will)21 -b(be)f(internally)f(represented)g(by)g(an)i(element)e(node)g(for)h -Fq(x)g Fv(with)h(three)f(subnodes:)e(the)j(\002rst)g -Fq(z)f Fv(element,)g(a)g(data)396 1506 y(node)f(containing)g(the)h -(space)g(character)m(,)e(and)i(the)g(second)g Fq(z)g -Fv(element.)g(In)f(contrast)h(to)g(this,)h(the)f(term)396 -1686 y Fq()44 b()396 1877 y Fv(is)21 b(represented)e(by) -h(an)g(element)f(node)g(for)h Fq(y)h Fv(with)f(only)f -Fr(two)i Fv(subnodes,)e(the)h(tw)o(o)g Fq(z)h Fv(elements.)e(There)h -(is)h(no)f(data)396 1985 y(node)f(for)h(the)g(space)g(character)f -(because)h(spaces)g(are)g(ignored)f(in)h(the)g(character)n(-free)e -(element)i Fq(y)p Fv(.)-2 2355 y Fp(3.4.2.)35 b(The)f(representation)h -(of)e(c)o(haracter)h(data)396 2523 y Fv(The)20 b(XML)g(speci\002cation) -g(allo)n(ws)g(all)h(Unicode)e(characters)g(in)i(XML)f(te)o(xts.)g(This) -g(parser)g(can)g(be)g(con\002gured)e(such)396 2631 y(that)j(UTF-8)e(is) -i(used)f(to)h(represent)e(the)h(characters)f(internally;)g(ho)n(we)n(v) -o(er)m(,)f(the)i(def)o(ault)g(character)e(encoding)h(is)396 -2738 y(ISO-8859-1.)e(\(Currently)-5 b(,)18 b(no)i(other)f(encodings)g -(are)h(possible)g(for)f(the)i(internal)e(string)h(representation;)e -(the)i(type)396 2846 y Fq(Pxp_types.rep_encoding)d Fv(enumerates)i(the) -h(possible)g(encodings.)e(Principially)-5 b(,)19 b(the)h(parser)g -(could)f(use)h(an)o(y)396 2954 y(encoding)e(that)j(is)g -(ASCII-compatible,)d(b)n(ut)i(there)g(are)g(currently)e(only)i(le)o -(xical)f(analyzers)h(for)f(UTF-8)h(and)396 3062 y(ISO-8859-1.)d(It)k -(is)g(currently)d(impossible)i(to)g(use)h(UTF-16)e(or)h(UCS-4)g(as)h -(internal)f(encodings)e(\(or)i(other)f(multibyte)396 -3170 y(encodings)g(which)g(are)h(not)g(ASCII-compatible\))e(unless)i -(major)g(parts)g(of)g(the)g(parser)g(are)g(re)n(written)f(-)i(unlik)o -(ely)-5 b(...\))396 3320 y(The)20 b(internal)g(encoding)e(may)h(be)h -(dif)n(ferent)f(from)g(the)h(e)o(xternal)f(encoding)f(\(speci\002ed)i -(in)g(the)g(XML)h(declaration)396 3428 y Fo(<)p Fq(?xml)44 -b(...)g(encoding="..."?)p Fo(>)p Fv(\);)18 b(in)j(this)f(case)h(the)f -(strings)g(are)g(automatically)f(con)m(v)o(erted)f(to)i(the)g(internal) -396 3535 y(encoding.)396 3685 y(If)g(the)h(internal)e(encoding)f(is)j -(ISO-8859-1,)c(it)k(is)g(possible)f(that)g(there)g(are)g(characters)g -(that)g(cannot)f(be)h(represented.)396 3793 y(In)g(this)h(case,)f(the)g -(parser)g(ignores)f(such)h(characters)f(and)h(prints)g(a)h(w)o(arning)e -(\(to)h(the)g Fq(collect_warning)e Fv(object)396 3901 -y(that)j(must)f(be)g(passed)g(when)g(the)g(parser)f(is)i(called\).)396 -4050 y(The)f(XML)g(speci\002cation)g(allo)n(ws)g(lines)h(to)f(be)g -(separated)g(by)f(single)h(LF)h(characters,)e(by)h(CR)h(LF)g(character) -396 4158 y(sequences,)e(or)h(by)g(single)g(CR)i(characters.)d -(Internally)-5 b(,)18 b(these)i(separators)f(are)h(al)o(w)o(ays)h(con)m -(v)o(erted)d(to)i(single)g(LF)396 4266 y(characters.)396 -4416 y(The)g(parser)g(guarantees)e(that)j(there)e(are)i(ne)n(v)o(er)d -(tw)o(o)j(adjacent)e(data)h(nodes;)g(if)g(necessary)-5 -b(,)19 b(data)h(material)g(that)g(w)o(ould)396 4523 y(otherwise)g(be)g -(represented)e(by)i(se)n(v)o(eral)g(nodes)f(is)i(collapsed)f(into)f -(one)h(node.)f(Note)h(that)g(you)g(can)g(still)h(create)f(node)396 -4631 y(trees)h(with)f(adjacent)g(data)g(nodes;)f(ho)n(we)n(v)o(er)m(,)f -(the)i(parser)g(does)f(not)h(return)f(such)h(trees.)p -Black 3800 5278 a Fr(70)p Black eop -%%Page: 71 71 -71 70 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black 396 579 a Fv(Note)g(that)h(CD)m(A) --9 b(T)h(A)20 b(sections)g(are)g(not)g(represented)f(specially;)h(such) -g(sections)g(are)g(added)f(to)h(the)h(current)d(data)396 -687 y(material)i(that)g(being)g(collected)f(for)h(the)g(ne)o(xt)f(data) -h(node.)-2 1056 y Fp(3.4.3.)35 b(The)f(representation)h(of)e(entities)h -(within)g(documents)396 1224 y Fr(Entities)21 b(ar)m(e)f(not)g(r)m(epr) -m(esented)f(within)i(documents!)d Fv(If)i(the)h(parser)e(\002nds)h(an)h -(entity)e(reference)g(in)h(the)g(document)396 1332 y(content,)f(the)h -(reference)f(is)i(immediately)e(e)o(xpanded,)e(and)j(the)g(parser)g -(reads)g(the)g(e)o(xpansion)e(te)o(xt)i(instead)g(of)g(the)396 -1440 y(reference.)-2 1810 y Fp(3.4.4.)35 b(The)f(representation)h(of)e -(attrib)n(utes)396 1977 y Fv(As)21 b(attrib)n(ute)f(v)n(alues)g(are)g -(composed)e(of)i(Unicode)f(characters,)g(too,)h(the)g(same)h(problems)d -(with)j(the)f(character)396 2085 y(encoding)e(arise)j(as)g(for)e -(character)g(material.)h(Attrib)n(ute)g(v)n(alues)g(are)g(con)m(v)o -(erted)d(to)k(the)f(internal)f(encoding,)f(too;)i(and)396 -2193 y(if)h(there)e(are)i(characters)e(that)h(cannot)f(be)h -(represented,)e(these)j(are)f(dropped,)e(and)h(a)i(w)o(arning)e(is)i -(printed.)396 2343 y(Attrib)n(ute)f(v)n(alues)g(are)g(normalized)e -(before)h(the)o(y)h(are)g(returned)e(by)i(methods)f(lik)o(e)h -Fq(attribute)p Fv(.)f(First,)i(an)o(y)396 2451 y(remaining)e(entity)h -(references)e(are)i(e)o(xpanded;)e(if)j(necessary)-5 -b(,)19 b(e)o(xpansion)f(is)j(performed)c(recursi)n(v)o(ely)-5 -b(.)18 b(Second,)396 2558 y(ne)n(wline)i(characters)f(\(an)o(y)g(of)h -(LF)-7 b(,)21 b(CR)g(LF)-7 b(,)21 b(or)f(CR)h(characters\))e(are)h(con) -m(v)o(erted)e(to)i(single)g(space)h(characters.)e(Note)396 -2666 y(that)i(especially)e(the)i(latter)f(action)g(is)h(prescribed)d -(by)i(the)g(XML)g(standard)f(\(b)n(ut)41 b(is)21 b(not)f(con)m(v)o -(erted)e(such)i(that)g(it)h(is)396 2774 y(still)h(possible)e(to)g -(include)f(line)h(feeds)g(into)g(attrib)n(utes\).)-2 -3144 y Fp(3.4.5.)35 b(The)f(representation)h(of)e(pr)n(ocessing)h -(instructions)396 3312 y Fv(Processing)20 b(instructions)f(are)h -(parsed)g(to)g(some)g(e)o(xtent:)f(The)h(\002rst)h(w)o(ord)f(of)g(the)g -(PI)g(is)i(called)e(the)g(tar)o(get,)f(and)g(it)i(is)396 -3420 y(stored)f(separated)f(from)g(the)i(rest)f(of)g(the)g(PI:)396 -3600 y Fq()396 3791 y Fv(The)20 b(e)o(xact)g -(location)f(where)h(a)g(PI)h(occurs)e(is)i(not)f(represented)f(\(by)g -(def)o(ault\).)g(The)h(parser)f(puts)i(the)f(PI)g(into)g(the)396 -3899 y(object)g(that)g(represents)g(the)g(embracing)e(construct)h(\(an) -h(element,)f(a)i(DTD,)f(or)g(the)g(whole)g(document\);)e(that)i(means) -396 4007 y(you)g(can)g(\002nd)f(out)h(which)g(PIs)h(occur)e(in)h(a)h -(certain)f(element,)f(in)h(the)h(DTD,)f(or)g(in)g(the)g(whole)g -(document,)e(b)n(ut)i(you)396 4114 y(cannot)f(lookup)g(the)h(e)o(xact)g -(position)f(within)h(the)g(construct.)396 4264 y(If)g(you)g(require)e -(the)j(e)o(xact)e(location)h(of)g(PIs,)g(it)h(is)g(possible)f(to)g -(create)g(e)o(xtra)g(nodes)f(for)h(them.)f(This)i(mode)e(is)396 -4372 y(controled)g(by)g(the)i(option)e Fq(enable_pinstr_nodes)p -Fv(.)e(The)j(additional)f(nodes)g(ha)n(v)o(e)h(the)g(node)f(type)h -Fq(T_pinstr)396 4480 y Fn(target)p Fv(,)g(and)f(are)i(created)e(from)g -(special)h(e)o(x)o(emplars)f(contained)f(in)j(the)f Fq(spec)g -Fv(\(see)g(pxp_document.mli\).)p Black 3800 5278 a Fr(71)p -Black eop -%%Page: 72 72 -72 71 bop Black 2225 67 a Fr(Chapter)20 b(3.)g(The)g(objects)g(r)m(epr) -m(esenting)g(the)g(document)p Black -2 583 a Fp(3.4.6.)35 -b(The)f(representation)h(of)e(comments)396 751 y Fv(Normally)-5 -b(,)19 b(comments)g(are)h(not)g(represented;)e(the)o(y)i(are)g(dropped) -e(by)h(def)o(ault.)h(Ho)n(we)n(v)o(er)m(,)e(if)i(you)f(require)g(them,) -h(it)h(is)396 859 y(possible)f(to)h(create)e Fq(T_comment)h -Fv(nodes)f(for)h(them.)f(This)i(mode)e(can)h(be)g(speci\002ed)g(by)g -(the)g(option)396 967 y Fq(enable_comment_nodes)p Fv(.)d(Comment)j -(nodes)f(are)h(created)g(from)f(special)h(e)o(x)o(emplars)f(contained)f -(in)j(the)f Fq(spec)396 1075 y Fv(\(see)h(pxp_document.mli\).)15 -b(Y)-9 b(ou)19 b(can)h(access)h(the)f(contents)g(of)g(comments)f -(through)f(the)i(method)f Fq(comment)p Fv(.)-2 1444 y -Fp(3.4.7.)35 b(The)f(attrib)n(utes)f Fc(xml:lang)d Fp(and)k -Fc(xml:space)396 1612 y Fv(These)20 b(attrib)n(utes)g(are)g(not)g -(supported)f(specially;)h(the)o(y)f(are)h(handled)f(lik)o(e)h(an)o(y)g -(other)f(attrib)n(ute.)-2 1982 y Fp(3.4.8.)35 b(And)f(what)f(about)h -(namespaces?)396 2149 y Fv(Currently)-5 b(,)19 b(there)g(is)i(no)f -(special)h(support)d(for)i(namespaces.)f(Ho)n(we)n(v)o(er)m(,)f(the)i -(parser)g(allo)n(ws)g(it)h(that)f(the)h(colon)e(occurs)396 -2257 y(in)i(names)e(such)h(that)h(it)g(is)g(possible)f(to)g(implement)f -(namespaces)g(on)h(top)g(of)g(the)g(current)f(API.)396 -2407 y(Some)h(future)f(release)h(of)g(PXP)h(will)g(support)e -(namespaces)g(as)i(b)n(uilt-in)f(feature...)p Black 3800 -5278 a Fr(72)p Black eop -%%Page: 73 73 -73 72 bop Black Black -2 621 a Fs(Chapter)48 b(4.)f(Con\002guring)j -(and)e(calling)f(the)h(par)m(ser)-2 1055 y Fx(4.1.)39 -b(Over)q(vie)n(w)396 1235 y Fv(There)20 b(are)g(the)g(follo)n(wing)f -(main)g(functions)g(in)m(v)n(oking)f(the)i(parser)g(\(in)g(Pxp_yacc\):) -p Black 396 1558 a Ft(\225)p Black 60 w Fr(par)o(se_document_entity:)d -Fv(Y)-9 b(ou)19 b(w)o(ant)i(to)f(parse)g(a)g(complete)g(and)f(closed)h -(document)e(consisting)i(of)g(a)g(DTD)h(and)479 1666 -y(the)f(document)f(body;)g(the)h(body)f(is)i(v)n(alidated)e(against)g -(the)h(DTD.)h(This)f(mode)f(is)i(interesting)f(if)g(you)f(ha)n(v)o(e)h -(a)h(\002le)479 1835 y Fq()f -()g(...)h()396 1984 y Fv(and)20 b(you)f(can)h(accept)g(an) -o(y)f(DTD)i(that)f(is)h(included)e(in)h(the)g(\002le)h(\(e.g.)f -(because)f(the)h(\002le)h(is)g(under)e(your)g(control\).)p -Black 396 2092 a Ft(\225)p Black 60 w Fr(par)o(se_wfdocument_entity:)e -Fv(Y)-9 b(ou)20 b(w)o(ant)g(to)g(parse)g(a)h(complete)e(and)h(closed)f -(document)g(consisting)g(of)h(a)h(DTD)479 2200 y(and)f(the)g(document)e -(body;)h(b)n(ut)h(the)h(body)d(is)k(not)d(v)n(alidated,)g(only)h(check) -o(ed)e(for)i(well-formedness.)e(This)i(mode)f(is)479 -2308 y(preferred)f(if)j(v)n(alidation)d(costs)j(too)f(much)f(time)i(or) -f(if)g(the)g(DTD)h(is)g(missing.)p Black 396 2416 a Ft(\225)p -Black 60 w Fr(par)o(se_dtd_entity:)d Fv(Y)-9 b(ou)20 -b(w)o(ant)g(only)f(to)i(parse)e(an)i(entity)e(\(\002le\))i(containing)d -(the)i(e)o(xternal)f(subset)h(of)g(a)h(DTD.)479 2524 -y(Sometimes)f(it)h(is)g(interesting)e(to)i(read)e(such)h(a)h(DTD,)f -(for)g(e)o(xample)e(to)j(compare)d(it)j(with)g(the)f(DTD)g(included)f -(in)h(a)479 2632 y(document,)e(or)i(to)g(apply)g(the)g(ne)o(xt)f(mode:) -p Black 396 2740 a Ft(\225)p Black 60 w Fr(par)o(se_content_entity:)e -Fv(Y)-9 b(ou)20 b(w)o(ant)g(only)g(to)g(parse)g(an)g(entity)g -(\(\002le\))g(containing)e(a)j(fragment)d(of)i(a)h(document)479 -2848 y(body;)e(this)i(fragment)d(is)j(v)n(alidated)f(against)f(the)h -(DTD)h(you)e(pass)i(to)f(the)g(function.)e(Especially)-5 -b(,)19 b(the)i(fragment)479 2956 y(must)g(not)e(ha)n(v)o(e)h(a)65 -b Fo(<)p Fq(!DOCTYPE)p Fo(>)19 b Fv(clause,)h(and)g(must)g(directly)g -(be)o(gin)f(with)h(an)g(element.)f(The)h(element)g(is)479 -3064 y(v)n(alidated)f(against)h(the)g(DTD.)g(This)h(mode)e(is)i -(interesting)e(if)i(you)e(w)o(ant)h(to)h(check)e(documents)f(against)i -(a)h(\002x)o(ed,)479 3172 y(immutable)e(DTD.)p Black -396 3280 a Ft(\225)p Black 60 w Fr(par)o(se_wfcontent_entity:)f -Fv(This)i(function)f(also)h(parses)g(a)h(single)f(element)g(without)f -(DTD,)h(b)n(ut)g(does)g(not)g(v)n(alidate)479 3388 y(it.)p -Black 396 3495 a Ft(\225)p Black 60 w Fr(e)n(xtr)o(act_dtd_fr)l -(om_document_entity:)15 b Fv(This)20 b(function)f(e)o(xtracts)g(the)i -(DTD)f(from)f(a)i(closed)f(document)479 3603 y(consisting)g(of)g(a)g -(DTD)h(and)e(a)i(document)d(body)-5 b(.)18 b(Both)j(the)f(internal)f -(and)h(the)g(e)o(xternal)f(subsets)h(are)h(e)o(xtracted.)396 -3794 y(In)f(man)o(y)f(cases,)i Fq(parse_document_entity)c -Fv(is)k(the)f(preferred)e(mode)i(to)g(parse)g(a)g(document)f(in)h(a)h -(v)n(alidating)396 3902 y(w)o(ay)-5 b(,)20 b(and)g Fq -(parse_wfdocument_entity)c Fv(is)22 b(the)e(mode)f(of)h(choice)f(to)i -(parse)f(a)g(\002le)h(while)f(only)g(checking)e(for)396 -4010 y(well-formedness.)396 4160 y(There)i(are)g(a)g(number)f(of)h(v)n -(ariations)f(of)h(these)g(modes.)f(One)h(important)f(application)g(of)h -(a)g(parser)g(is)h(to)f(check)396 4268 y(documents)f(of)h(an)g -(untrusted)f(source)g(against)h(a)g(\002x)o(ed)g(DTD.)g(One)g(solution) -f(is)i(to)g(not)f(allo)n(w)g(the)g Fo(<)p Fq(!DOCTYPE)p -Fo(>)396 4375 y Fv(clause)g(in)h(these)f(documents,)e(and)i(treat)g -(the)h(document)d(lik)o(e)i(a)h(fragment)d(\(using)i(mode)f -Fr(par)o(se_content_entity)p Fv(\).)396 4483 y(This)i(is)g(v)o(ery)e -(simple,)h(b)n(ut)g(in\003e)o(xible;)f(users)i(of)e(such)h(a)h(system)f -(cannot)f(e)n(v)o(en)h(de\002ne)f(additional)g(entities)i(to)396 -4591 y(abbre)n(viate)e(frequent)f(phrases)i(of)g(their)g(te)o(xt.)396 -4741 y(It)h(may)e(be)i(necessary)e(to)h(ha)n(v)o(e)g(a)h(more)e -(intelligent)g(check)o(er)-5 b(.)20 b(F)o(or)g(e)o(xample,)e(it)j(is)g -(also)g(possible)e(to)i(parse)f(the)396 4849 y(document)e(to)j(check)e -(fully)-5 b(,)19 b(i.e.)h(with)h(DTD,)f(and)f(to)i(compare)d(this)j -(DTD)f(with)h(the)f(prescribed)f(one.)g(In)h(order)f(to)p -Black 3800 5278 a Fr(73)p Black eop -%%Page: 74 74 -74 73 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(fully)g(parse)g(the)g -(document,)e(mode)h Fr(par)o(se_document_entity)e Fv(is)k(applied,)e -(and)h(to)g(get)g(the)g(DTD)h(to)f(compare)f(with)396 -687 y(mode)g Fr(par)o(se_dtd_entity)f Fv(can)i(be)h(used.)396 -836 y(There)f(is)h(another)d(v)o(ery)i(important)e(con\002gurable)g -(aspect)i(of)g(the)g(parser:)g(the)g(so-called)g(resolv)o(er)-5 -b(.)19 b(The)h(task)g(of)g(the)396 944 y(resolv)o(er)f(is)i(to)g -(locate)f(the)g(contents)f(of)h(an)g(\(e)o(xternal\))f(entity)g(for)h -(a)h(gi)n(v)o(en)e(entity)g(name,)h(and)f(to)i(mak)o(e)e(the)i -(contents)396 1052 y(accessible)g(as)f(a)h(character)e(stream.)h -(\(Furthermore,)d(it)k(also)f(normalizes)g(the)g(character)f(set;)i(b)n -(ut)f(this)h(is)g(a)f(detail)h(we)396 1160 y(can)f(ignore)f(here.\))g -(Consider)h(you)f(ha)n(v)o(e)h(a)g(\002le)h(called)f -Fq("main.xml")f Fv(containing)396 1340 y Fq()396 1437 y(\045sub;)396 -1628 y Fv(and)20 b(a)h(\002le)f(stored)g(in)g(the)h(subdirectory)c -Fq("sub")j Fv(with)h(name)e Fq("sub.xml")g Fv(containing)396 -1808 y Fq() -396 1906 y(\045subsub;)396 2097 y Fv(and)20 b(a)g(\002le)h(stored)e(in) -h(the)g(subdirectory)d Fq("subsub")j Fv(of)f Fq("sub")h -Fv(with)g(name)f Fq("subsub.xml")g Fv(\(the)g(contents)h(of)f(this)396 -2204 y(\002le)i(do)f(not)g(matter\).)f(Here,)h(the)g(resolv)o(er)f -(must)h(track)g(that)g(the)g(second)g(entity)g Fq(subsub)f -Fv(is)i(located)f(in)g(the)h(directory)396 2312 y Fq("sub/subsub")p -Fv(,)e(i.e.)h(the)g(dif)n(\002culty)f(is)i(to)g(interpret)e(the)h -(system)g(\(\002le\))h(names)e(of)h(entities)h(relati)n(v)o(e)e(to)i -(the)f(entities)396 2420 y(containing)f(them,)g(e)n(v)o(en)g(if)i(the)f -(entities)h(are)f(deeply)f(nested.)396 2570 y(There)h(is)h(not)f(a)g -(\002x)o(ed)g(resolv)o(er)f(already)g(doing)g(e)n(v)o(erything)e(right) -j(-)g(resolving)f(entity)h(names)g(is)h(a)f(task)h(that)f(highly)396 -2678 y(depends)f(on)h(the)g(en)m(vironment.)d(The)j(XML)g -(speci\002cation)f(only)h(demands)f(that)h Fq(SYSTEM)g -Fv(entities)g(are)g(interpreted)396 2786 y(lik)o(e)h(URLs)g(\(which)e -(is)i(not)f(v)o(ery)f(precise,)h(as)h(there)e(are)i(lots)f(of)g(URL)h -(schemes)f(in)g(use\),)g(hoping)f(that)h(this)h(helps)396 -2894 y(o)o(v)o(ercoming)c(the)j(local)g(peculiarities)g(of)g(the)g(en)m -(vironment;)d(the)k(idea)f(is)h(that)f(if)h(you)e(do)h(not)f(kno)n(w)h -(your)396 3001 y(en)m(vironment)d(you)j(can)g(refer)f(to)h(other)g -(entities)g(by)g(denoting)e(URLs)k(for)d(them.)h(I)g(think)g(that)g -(this)h(interpretation)d(of)396 3109 y Fq(SYSTEM)i Fv(names)g(may)g(ha) -n(v)o(e)f(some)h(applications)f(in)i(the)f(internet,)f(b)n(ut)h(it)h -(is)g(not)f(the)g(\002rst)h(choice)f(in)g(general.)396 -3217 y(Because)h(of)f(this,)g(the)g(resolv)o(er)f(is)i(a)g(separate)f -(module)e(of)i(the)h(parser)e(that)h(can)g(be)h(e)o(xchanged)c(by)j -(another)f(one)g(if)396 3325 y(necessary;)h(more)f(precisely)-5 -b(,)19 b(the)h(parser)g(already)f(de\002nes)h(se)n(v)o(eral)f(resolv)o -(ers.)396 3475 y(The)h(follo)n(wing)f(resolv)o(ers)g(do)h(already)f(e)o -(xist:)p Black 396 3707 a Ft(\225)p Black 60 w Fv(Resolv)o(ers)h -(reading)f(from)g(arbitrary)g(input)g(channels.)g(These)h(can)g(be)g -(con\002gured)e(such)i(that)g(a)h(certain)f(ID)g(is)479 -3815 y(associated)g(with)h(the)f(channel;)f(in)h(this)h(case)g(inner)e -(references)g(to)h(e)o(xternal)f(entities)i(can)f(be)g(resolv)o(ed.)e -(There)i(is)479 3923 y(also)h(a)f(special)h(resolv)o(er)e(that)h -(interprets)f(SYSTEM)i(IDs)f(as)h(URLs;)g(this)g(resolv)o(er)e(can)h -(process)g(relati)n(v)o(e)479 4031 y(SYSTEM)h(names)e(and)h(determine)f -(the)h(corresponding)d(absolute)i(URL.)p Black 396 4139 -a Ft(\225)p Black 60 w Fv(A)i(resolv)o(er)e(that)h(reads)g(al)o(w)o -(ays)h(from)e(a)i(gi)n(v)o(en)d(O'Caml)j(string.)e(This)i(resolv)o(er)e -(is)i(not)f(able)g(to)g(resolv)o(e)f(further)479 4247 -y(names)h(unless)g(the)h(string)f(is)h(not)f(associated)g(with)g(an)o -(y)f(name,)h(i.e.)g(if)g(the)g(document)f(contained)f(in)j(the)f -(string)479 4355 y(refers)g(to)g(an)g(e)o(xternal)f(entity)-5 -b(,)20 b(this)g(reference)f(cannot)g(be)h(follo)n(wed)f(in)h(this)h -(case.)p Black 396 4463 a Ft(\225)p Black 60 w Fv(A)g(resolv)o(er)e -(for)g(\002le)i(names.)f(The)g Fq(SYSTEM)g Fv(name)f(is)i(interpreted)e -(as)i(\002le)f(URL)h(with)g(the)f(slash)h("/")f(as)h(separator)479 -4571 y(for)f(directories.)f(-)h(This)h(resolv)o(er)d(is)k(deri)n(v)o -(ed)c(from)h(the)h(generic)f(URL)i(resolv)o(er)-5 b(.)396 -4720 y(The)20 b(interf)o(ace)f(a)i(resolv)o(er)e(must)h(ha)n(v)o(e)g -(is)h(documented,)c(so)k(it)g(is)g(possible)f(to)g(write)g(your)f(o)n -(wn)h(resolv)o(er)-5 b(.)19 b(F)o(or)396 4828 y(e)o(xample,)g(you)g -(could)g(connect)g(the)h(parser)g(with)g(an)h(HTTP)f(client,)g(and)f -(resolv)o(e)h(URLs)h(of)f(the)g(HTTP)g(namespace.)p Black -3800 5278 a Fr(74)p Black eop -%%Page: 75 75 -75 74 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(The)g(resolv)o(er)f -(classes)i(support)e(that)h(se)n(v)o(eral)g(independent)e(resolv)o(ers) -h(are)h(combined)e(to)i(one)g(more)f(po)n(werful)396 -687 y(resolv)o(er;)g(thus)h(it)h(is)g(possible)f(to)h(combine)d(a)j -(self-written)e(resolv)o(er)g(with)i(the)f(already)f(e)o(xisting)g -(resolv)o(ers.)396 836 y(Note)h(that)h(the)f(e)o(xisting)f(resolv)o -(ers)h(only)f(interpret)g Fq(SYSTEM)h Fv(names,)f(not)h -Fq(PUBLIC)g Fv(names.)g(If)g(it)h(helps)f(you,)f(it)h(is)396 -944 y(possible)g(to)f(de\002ne)h(resolv)o(ers)e(for)h -Fq(PUBLIC)h Fv(names,)f(too;)g(for)g(e)o(xample,)f(such)i(a)g(resolv)o -(er)e(could)h(look)g(up)g(the)h(public)396 1052 y(name)g(in)g(a)h(hash) -f(table,)g(and)f(map)h(it)h(to)f(a)h(system)f(name)g(which)g(is)h -(passed)f(o)o(v)o(er)f(to)h(the)g(e)o(xisting)g(resolv)o(er)e(for)396 -1160 y(system)j(names.)e(It)i(is)g(relati)n(v)o(ely)e(simple)h(to)g -(pro)o(vide)f(such)g(a)i(resolv)o(er)-5 b(.)-2 1579 y -Fx(4.2.)39 b(Resolver)n(s)e(and)i(sour)m(ces)-2 1907 -y Fp(4.2.1.)c(Using)f(the)g(b)n(uilt-in)f(resolver)n(s)i(\(called)g -(sour)n(ces\))396 2075 y Fv(The)20 b(type)g Fq(source)g -Fv(enumerates)e(the)j(tw)o(o)f(possibilities)h(where)e(the)h(document)f -(to)h(parse)g(comes)g(from.)396 2255 y Fq(type)44 b(source)g(=)576 -2352 y(Entity)f(of)i(\(\(dtd)f(-)p Fo(>)g Fq(Pxp_entity.entity\))e(*)j -(Pxp_reader.resolver\))486 2449 y(|)g(ExtID)f(of)g(\(ext_id)g(*)g -(Pxp_reader.resolver\))396 2640 y Fv(Y)-9 b(ou)20 b(normally)e(need)i -(not)g(to)g(w)o(orry)f(about)h(this)g(type)g(as)h(there)f(are)g(con)m -(v)o(enience)d(functions)i(that)h(create)g Fq(source)396 -2748 y Fv(v)n(alues:)p Black 396 3105 a Ft(\225)p Black -60 w Fq(from_file)44 b(s)p Fv(:)20 b(The)g(document)e(is)j(read)f(from) -f(\002le)i Fq(s)p Fv(;)g(you)e(may)h(specify)f(absolute)h(or)g(relati)n -(v)o(e)f(path)h(names.)479 3213 y(The)g(\002le)h(name)f(must)g(be)g -(encoded)e(as)j(UTF-8)f(string.)479 3362 y(There)g(is)h(an)f(optional)f -(ar)o(gument)f Fq(~system_encoding)g Fv(specifying)g(the)j(character)d -(encoding)h(which)g(is)i(used)479 3470 y(for)f(the)g(names)g(of)g(the)g -(\002le)h(system.)f(F)o(or)g(e)o(xample,)e(if)j(this)g(encoding)d(is)j -(ISO-8859-1)c(and)j Fq(s)g Fv(is)i(also)e(a)479 3578 -y(ISO-8859-1)e(string,)h(you)h(can)g(form)f(the)h(source:)479 -3717 y Fq(let)45 b(s_utf8)88 b(=)i(recode_string)42 b -(~in_enc:`Enc_iso88591)g(~out_enc:`Enc_utf8)g(s)i(in)479 -3814 y(from_file)g(~system_encoding:`Enc_iso88591)39 -b(s_utf8)479 4005 y Fv(This)21 b Fq(source)e Fv(has)i(the)f(adv)n -(antage)e(that)j(it)f(is)i(able)e(to)g(resolv)o(e)f(inner)h(e)o -(xternal)f(entities;)h(i.e.)g(if)h(your)e(document)479 -4113 y(includes)g(data)g(from)g(another)f(\002le)i(\(using)f(the)g -Fq(SYSTEM)g Fv(attrib)n(ute\),)g(this)g(mode)g(will)h(\002nd)f(that)h -(\002le.)g(Ho)n(we)n(v)o(er)m(,)d(this)479 4221 y(mode)j(cannot)f -(resolv)o(e)g Fq(PUBLIC)h Fv(identi\002ers)f(nor)h Fq(SYSTEM)g -Fv(identi\002ers)f(other)h(than)g("\002le:".)p Black -396 4370 a Ft(\225)p Black 60 w Fq(from_channel)43 b(ch)p -Fv(:)21 b(The)e(document)g(is)i(read)e(from)h(the)g(channel)f -Fq(ch)p Fv(.)h(In)g(general,)f(this)h(source)g(also)g(supports)479 -4478 y(\002le)h(URLs)g(found)e(in)h(the)g(document;)f(ho)n(we)n(v)o(er) -m(,)e(by)j(def)o(ault)f(only)h(absolute)f(URLs)i(are)f(understood.)e -(It)i(is)479 4586 y(possible)g(to)h(associate)f(an)g(ID)g(with)h(the)f -(channel)f(such)h(that)g(the)g(resolv)o(er)f(kno)n(ws)h(ho)n(w)f(to)i -(interpret)e(relati)n(v)o(e)479 4694 y(URLs:)479 4832 -y Fq(from_channel)43 b(~id:\(System)g("file:///dir/dir1/"\))f(ch)p -Black 3800 5278 a Fr(75)p Black eop -%%Page: 76 76 -76 75 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(There)g(is)h(also)f -(the)g(~system_encoding)e(ar)o(gument)f(specifying)i(ho)n(w)h(\002le)h -(names)e(are)i(encoded.)d(-)i(The)g(e)o(xample)479 687 -y(from)f(abo)o(v)o(e)g(can)h(also)g(be)h(written)f(\(b)n(ut)f(it)i(is)g -(no)f(longer)f(possible)h(to)g(interpret)f(relati)n(v)o(e)h(URLs)h -(because)e(there)h(is)479 795 y(no)g(~id)g(ar)o(gument,)e(and)i -(computing)d(this)k(ar)o(gument)d(is)j(relati)n(v)o(ely)e(complicated)g -(because)g(it)i(must)f(be)h(a)f(v)n(alid)479 903 y(URL\):)479 -1041 y Fq(let)45 b(ch)f(=)h(open_in)e(s)i(in)479 1138 -y(let)g(src)f(=)h(from_channel)d(~system_encoding:`Enc_iso88591)e(ch)45 -b(in)479 1236 y(...;)479 1333 y(close_in)f(ch)p Black -396 1482 a Ft(\225)p Black 60 w Fq(from_string)f(s)p -Fv(:)21 b(The)f(string)g Fq(s)g Fv(is)h(the)g(document)d(to)i(parse.)g -(This)g(mode)f(is)j(not)d(able)h(to)h(interpret)e(\002le)i(names)479 -1590 y(of)f Fq(SYSTEM)g Fv(clauses,)g(nor)g(it)h(can)f(look)f(up)h -Fq(PUBLIC)f Fv(identi\002ers.)479 1740 y(Normally)-5 -b(,)19 b(the)h(encoding)e(of)i(the)g(string)g(is)h(detected)e(as)i -(usual)f(by)g(analyzing)f(the)h(XML)g(declaration,)e(if)j(an)o(y)-5 -b(.)479 1847 y(Ho)n(we)n(v)o(er)m(,)18 b(it)j(is)g(also)g(possible)f -(to)g(specify)g(the)g(encoding)e(directly:)479 1986 y -Fq(let)45 b(src)f(=)h(from_string)e(~fixenc:`ISO-8859-2)e(s)p -Black 396 2177 a Ft(\225)p Black 60 w Fq(ExtID)j(\(id,)g(r\))p -Fv(:)21 b(The)f(document)e(to)i(parse)g(is)h(denoted)e(by)h(the)g -(identi\002er)g Fq(id)g Fv(\(either)f(a)i Fq(SYSTEM)f -Fv(or)g Fq(PUBLIC)479 2285 y Fv(clause\),)g(and)g(this)g(identi\002er)g -(is)h(interpreted)d(by)i(the)g(resolv)o(er)f Fq(r)p Fv(.)i(Use)f(this)h -(mode)e(if)i(you)e(ha)n(v)o(e)h(written)g(your)f(o)n(wn)479 -2393 y(resolv)o(er)-5 b(.)479 2542 y(Which)20 b(character)f(sets)j(are) -e(possible)g(depends)e(on)i(the)g(passed)h(resolv)o(er)d -Fq(r)p Fv(.)p Black 396 2692 a Ft(\225)p Black 60 w Fq(Entity)44 -b(\(get_entity,)f(r\))p Fv(:)20 b(The)g(document)e(to)j(parse)f(is)h -(returned)d(by)i(the)g(function)f(in)m(v)n(ocation)479 -2800 y Fq(get_entity)43 b(dtd)p Fv(,)20 b(where)g Fq(dtd)g -Fv(is)h(the)g(DTD)f(object)g(to)g(use)g(\(it)h(may)f(be)g(empty\).)f -(Inner)f(e)o(xternal)h(references)479 2908 y(occuring)g(in)h(this)h -(entity)e(are)i(resolv)o(ed)d(using)i(the)g(resolv)o(er)f -Fq(r)p Fv(.)479 3057 y(Which)h(character)f(sets)j(are)e(possible)g -(depends)e(on)i(the)g(passed)h(resolv)o(er)d Fq(r)p Fv(.)-2 -3510 y Fp(4.2.2.)35 b(The)f(resolver)g(API)396 3677 y -Fv(A)21 b(resolv)o(er)e(is)i(an)f(object)g(that)g(can)g(be)g(opened)e -(lik)o(e)j(a)f(\002le,)h(b)n(ut)f(you)f(do)h(not)g(pass)g(the)h(\002le) -f(name)g(to)g(the)g(resolv)o(er)m(,)f(b)n(ut)396 3785 -y(the)h(XML)h(identi\002er)e(of)h(the)g(entity)g(to)h(read)e(from)g -(\(either)h(a)g Fq(SYSTEM)g Fv(or)g Fq(PUBLIC)g Fv(clause\).)f(When)h -(opened,)f(the)396 3893 y(resolv)o(er)g(must)h(return)f(the)i -Fq(Lexing.lexbuf)d Fv(that)i(reads)g(the)h(characters.)e(The)g(resolv)o -(er)g(can)h(be)h(closed,)e(and)h(it)396 4001 y(can)g(be)g(cloned.)f -(Furthermore,)f(it)j(is)g(possible)f(to)g(tell)h(the)f(resolv)o(er)f -(which)h(character)f(set)i(it)g(should)e(assume.)h(-)g(The)396 -4109 y(follo)n(wing)f(from)g(Pxp_reader:)396 4289 y Fq(exception)44 -b(Not_competent)396 4386 y(exception)g(Not_resolvable)e(of)j(exn)396 -4581 y(class)f(type)g(resolver)g(=)486 4678 y(object)576 -4775 y(method)f(init_rep_encoding)f(:)j(rep_encoding)e(->)h(unit)576 -4872 y(method)f(init_warner)g(:)i(collect_warnings)d(->)j(unit)p -Black 3798 5278 a Fr(76)p Black eop -%%Page: 77 77 -77 76 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 576 579 a Fq(method)43 -b(rep_encoding)g(:)i(rep_encoding)576 676 y(method)e(open_in)h(:)h -(ext_id)f(->)g(Lexing.lexbuf)576 773 y(method)f(close_in)h(:)h(unit)576 -870 y(method)e(change_encoding)g(:)h(string)g(->)h(unit)576 -967 y(method)e(clone)h(:)h(resolver)576 1065 y(method)e(close_all)h(:)g -(unit)486 1162 y(end)396 1353 y Fv(The)20 b(resolv)o(er)f(object)h -(must)g(w)o(ork)f(as)i(follo)n(ws:)p Black 396 1627 a -Ft(\225)p Black 60 w Fv(When)f(the)h(parser)e(is)i(called,)f(it)h -(tells)g(the)f(resolv)o(er)f(the)h(w)o(arner)g(object)f(and)h(the)g -(internal)g(encoding)e(by)i(in)m(v)n(oking)479 1735 y -Fq(init_warner)f Fv(and)h Fq(init_rep_encoding)p Fv(.)d(The)j(resolv)o -(er)f(should)g(store)i(these)f(v)n(alues.)f(The)h(method)479 -1843 y Fq(rep_encoding)f Fv(should)g(return)g(the)h(internal)g -(encoding.)p Black 396 1950 a Ft(\225)p Black 60 w Fv(If)g(the)h -(parser)e(w)o(ants)i(to)f(read)g(from)f(the)h(resolv)o(er)m(,)e(it)j -(in)m(v)n(ok)o(es)f(the)g(method)f Fq(open_in)p Fv(.)g(Either)h(the)g -(resolv)o(er)479 2058 y(succeeds,)g(in)g(which)g(case)g(the)h -Fq(Lexing.lexbuf)d Fv(reading)h(from)g(the)h(\002le)h(or)f(stream)g -(must)g(be)h(returned,)d(or)479 2166 y(opening)h(f)o(ails.)h(In)g(the)g -(latter)h(case)f(the)h(method)d(implementation)g(should)h(raise)i(an)f -(e)o(xception)e(\(see)j(belo)n(w\).)p Black 396 2274 -a Ft(\225)p Black 60 w Fv(If)f(the)h(parser)e(\002nishes)i(reading,)d -(it)j(calls)g(the)f Fq(close_in)g Fv(method.)p Black -396 2382 a Ft(\225)p Black 60 w Fv(If)g(the)h(parser)e(\002nds)h(a)h -(reference)d(to)j(another)e(e)o(xternal)f(entity)i(in)h(the)f(input)f -(stream,)h(it)h(calls)g Fq(clone)f Fv(to)g(get)h(a)479 -2490 y(second)f(resolv)o(er)f(which)g(must)h(be)h(initially)f(closed)g -(\(not)f(yet)h(connected)f(with)h(an)g(input)f(stream\).)h(The)g -(parser)479 2598 y(then)g(in)m(v)n(ok)o(es)f Fq(open_in)h -Fv(and)f(the)i(other)e(methods)g(as)i(described.)p Black -396 2706 a Ft(\225)p Black 60 w Fv(If)f(you)g(already)f(kno)n(w)g(the)h -(character)f(set)i(of)f(the)g(input)g(stream,)f(you)h(should)f(recode)g -(it)i(to)f(the)g(internal)479 2814 y(encoding,)e(and)i(de\002ne)f(the)i -(method)d Fq(change_encoding)h Fv(as)i(an)f(empty)f(method.)p -Black 396 2922 a Ft(\225)p Black 60 w Fv(If)h(you)g(w)o(ant)g(to)g -(support)f(multiple)h(e)o(xternal)f(character)g(sets,)i(the)f(object)f -(must)i(follo)n(w)e(a)i(much)e(more)479 3030 y(complicated)g(protocol.) -f(Directly)i(after)g Fq(open_in)f Fv(has)i(been)e(called,)h(the)g -(resolv)o(er)f(must)h(return)f(a)i(le)o(xical)f(b)n(uf)n(fer)479 -3138 y(that)h(only)e(reads)h(one)g(byte)f(at)i(a)g(time.)f(This)g(is)h -(only)f(possible)f(if)i(you)e(create)h(the)g(le)o(xical)g(b)n(uf)n(fer) -f(with)479 3246 y Fq(Lexing.from_function)p Fv(;)e(the)j(function)d -(must)j(then)f(al)o(w)o(ays)h(return)e(1)i(if)f(the)h(EOF)g(is)g(not)f -(yet)h(reached,)e(and)h(0)479 3354 y(if)i(EOF)f(is)h(reached.)e(If)h -(the)g(parser)g(has)g(read)g(the)g(\002rst)h(line)f(of)g(the)h -(document,)c(it)k(will)g(in)m(v)n(ok)o(e)479 3461 y Fq(change_encoding) -e Fv(to)h(tell)h(the)f(resolv)o(er)f(which)h(character)e(set)j(to)g -(assume.)f(From)f(this)i(moment,)e(the)h(object)479 3569 -y(can)g(return)f(more)h(than)f(one)h(byte)g(at)g(once.)g(The)g(ar)o -(gument)d(of)j Fq(change_encoding)f Fv(is)i(either)e(the)i(parameter)d -(of)479 3677 y(the)i("encoding")e(attrib)n(ute)i(of)g(the)g(XML)h -(declaration,)d(or)i(the)g(empty)f(string)h(if)h(there)e(is)j(not)d(an) -o(y)h(XML)479 3785 y(declaration)f(or)h(if)g(the)h(declaration)d(does)i -(not)g(contain)f(an)h(encoding)e(attrib)n(ute.)479 3935 -y(At)j(the)f(be)o(ginning)e(the)i(resolv)o(er)f(must)h(only)g(return)f -(one)g(character)g(e)n(v)o(ery)g(time)h(something)f(is)i(read)f(from)f -(the)479 4043 y(le)o(xical)h(b)n(uf)n(fer)-5 b(.)19 b(The)h(reason)f -(for)h(this)h(is)g(that)f(you)f(otherwise)h(w)o(ould)f(not)h(e)o -(xactly)g(kno)n(w)f(at)h(which)g(position)f(in)479 4151 -y(the)h(input)g(stream)g(the)g(character)f(set)i(changes.)479 -4300 y(If)f(you)g(w)o(ant)g(automatic)f(recognition)f(of)i(the)g -(character)f(set,)i(it)g(is)g(up)f(to)g(the)g(resolv)o(er)f(object)h -(to)g(implement)f(this.)p Black 396 4449 a Ft(\225)p -Black 60 w Fv(If)h(an)g(error)g(occurs,)f(the)h(parser)g(calls)g(the)h -(method)d Fq(close_all)i Fv(for)f(the)h(top-le)n(v)o(el)f(resolv)o(er;) -g(this)i(method)479 4557 y(should)e(close)i(itself)g(\(if)f(not)g -(already)f(done\))f(and)i(all)h(clones.)396 4748 y Fu(Exceptions.)f -Fv(It)h(is)g(possible)f(to)g(chain)g(resolv)o(ers)f(such)h(that)g(when) -g(the)g(\002rst)h(resolv)o(er)e(is)i(not)f(able)g(to)g(open)f(the)396 -4856 y(entity)-5 b(,)20 b(the)g(other)f(resolv)o(ers)g(of)h(the)g -(chain)g(are)g(tried)g(in)g(turn.)g(The)g(method)e Fq(open_in)i -Fv(should)f(raise)i(the)f(e)o(xception)p Black 3797 5278 -a Fr(77)p Black eop -%%Page: 78 78 -78 77 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fq(Not_competent)f -Fv(to)h(indicate)g(that)g(the)g(ne)o(xt)g(resolv)o(er)f(should)g(try)h -(to)g(open)f(the)i(entity)-5 b(.)19 b(If)h(the)g(resolv)o(er)f(is)i -(able)f(to)396 687 y(handle)f(the)i(ID,)f(b)n(ut)g(some)g(other)f -(error)g(occurs,)g(the)i(e)o(xception)d Fq(Not_resolvable)g -Fv(should)i(be)g(raised)g(to)g(force)396 795 y(that)h(the)f(chain)f -(breaks.)396 944 y(Example:)g(Ho)n(w)h(to)h(de\002ne)e(a)i(resolv)o(er) -e(that)h(is)h(equi)n(v)n(alent)e(to)h(from_string:)e(...)-2 -1314 y Fp(4.2.3.)35 b(Prede\002ned)f(resolver)h(components)396 -1482 y Fv(There)20 b(are)g(some)g(classes)h(in)f(Pxp_reader)e(that)j -(de\002ne)e(common)g(resolv)o(er)f(beha)n(viour)-5 b(.)396 -1662 y Fq(class)44 b(resolve_read_this_channel)d(:)576 -1759 y(?id:ext_id)i(->)576 1856 y(?fixenc:encoding)f(->)576 -1953 y(?auto_close:bool)g(->)576 2050 y(in_channel)h(->)755 -2147 y(resolver)396 2338 y Fv(Reads)21 b(from)e(the)h(passed)g(channel) -f(\(it)i(may)f(be)g(e)n(v)o(en)f(a)i(pipe\).)e(If)h(the)g -Fq(~id)g Fv(ar)o(gument)e(is)j(passed)f(to)h(the)f(object,)f(the)396 -2446 y(created)h(resolv)o(er)f(accepts)h(only)f(this)i(ID.)f(Otherwise) -g(all)h(IDs)f(are)g(accepted.)f(-)i(Once)f(the)g(resolv)o(er)f(has)h -(been)396 2554 y(cloned,)f(it)h(does)g(not)f(accept)h(an)o(y)f(ID.)g -(This)h(means)g(that)g(this)g(resolv)o(er)e(cannot)h(handle)g(inner)g -(references)f(to)i(e)o(xternal)396 2662 y(entities.)h(Note)f(that)g -(you)f(can)h(combine)f(this)i(resolv)o(er)e(with)h(another)f(resolv)o -(er)g(that)h(can)g(handle)f(inner)g(references)396 2770 -y(\(such)h(as)h(resolv)o(e_as_\002le\);)d(see)j(class)g('combine')d -(belo)n(w)-5 b(.)19 b(-)h(If)g(you)g(pass)g(the)h Fq(~fixenc)e -Fv(ar)o(gument,)f(the)i(encoding)396 2878 y(of)g(the)g(channel)f(is)i -(set)g(to)g(the)f(passed)g(v)n(alue,)f(re)o(gardless)g(of)h(an)o(y)f -(auto-recognition)e(or)j(an)o(y)f(XML)h(declaration.)f(-)h(If)396 -2986 y Fq(~auto_close)43 b(=)i(true)20 b Fv(\(which)f(is)i(the)g(def)o -(ault\),)e(the)h(channel)f(is)i(closed)f(after)g(use.)g(If)g -Fq(~auto_close)43 b(=)396 3094 y(false)p Fv(,)20 b(the)g(channel)f(is)i -(left)g(open.)396 3315 y Fq(class)44 b(resolve_read_any_channel)d(:)576 -3413 y(?auto_close:bool)h(->)576 3510 y(channel_of_id:\(ext_id)f(->)j -(\(in_channel)f(*)i(encoding)f(option\)\))f(->)755 3607 -y(resolver)396 3798 y Fv(This)21 b(resolv)o(er)e(calls)h(the)h -(function)d Fq(~channel_of_id)h Fv(to)h(open)f(a)i(ne)n(w)f(channel)f -(for)g(the)h(passed)g Fq(ext_id)p Fv(.)g(This)396 3906 -y(function)f(must)h(either)g(return)f(the)h(channel)f(and)h(the)g -(encoding,)e(or)i(it)g(must)h(f)o(ail)f(with)h(Not_competent.)c(The)396 -4014 y(function)i(must)h(return)f Fq(None)h Fv(as)h(encoding)d(if)j -(the)f(def)o(ault)f(mechanism)g(to)h(recognize)f(the)h(encoding)e -(should)h(be)396 4122 y(used.)g(It)i(must)e(return)g -Fq(Some)44 b(e)20 b Fv(if)g(it)h(is)f(already)f(kno)n(wn)f(that)i(the)g -(encoding)d(of)j(the)f(channel)g(is)i Fq(e)p Fv(.)e(If)h -Fq(~auto_close)396 4230 y(=)45 b(true)19 b Fv(\(which)g(is)h(the)f(def) -o(ault\),)f(the)i(channel)e(is)i(closed)f(after)g(use.)h(If)f -Fq(~auto_close)43 b(=)h(false)p Fv(,)19 b(the)h(channel)e(is)396 -4337 y(left)j(open.)396 4559 y Fq(class)44 b(resolve_read_url_channel)d -(:)576 4656 y(?base_url:Neturl.url)g(->)576 4753 y(?auto_close:bool)h -(->)576 4851 y(url_of_id:\(ext_id)g(->)i(Neturl.url\))f(->)p -Black 3800 5278 a Fr(78)p Black eop -%%Page: 79 79 -79 78 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 576 579 a Fq -(channel_of_url:\(Neturl.url)40 b(->)45 b(\(in_channel)e(*)h(encoding)g -(option\)\))f(->)755 676 y(resolver)396 867 y Fv(When)20 -b(this)h(resolv)o(er)e(gets)h(an)h(ID)f(to)g(read)g(from,)f(it)i(calls) -g(the)f(function)e Fq(~url_of_id)h Fv(to)i(get)f(the)g(corresponding) -396 975 y(URL.)h(This)f(URL)h(may)f(be)g(a)g(relati)n(v)o(e)g(URL;)h -(ho)n(we)n(v)o(er)m(,)c(a)k(URL)g(scheme)f(must)g(be)g(used)g(which)f -(contains)h(a)h(path.)396 1083 y(The)f(resolv)o(er)f(con)m(v)o(erts)g -(the)h(URL)h(to)f(an)g(absolute)f(URL)i(if)g(necessary)-5 -b(.)19 b(The)g(second)h(function,)396 1191 y Fq(~channel_of_url)p -Fv(,)e(is)j(fed)f(with)h(the)f(absolute)f(URL)i(as)g(input.)e(This)h -(function)f(opens)g(the)i(resource)e(to)h(read)396 1299 -y(from,)f(and)h(returns)f(the)h(channel)f(and)h(the)g(encoding)e(of)i -(the)g(resource.)396 1448 y(Both)g(functions,)f Fq(~url_of_id)g -Fv(and)h Fq(~channel_of_url)p Fv(,)e(can)i(raise)g(Not_competent)e(to)i -(indicate)g(that)g(the)396 1556 y(object)g(is)h(not)f(able)g(to)g(read) -g(from)f(the)h(speci\002ed)g(resource.)f(Ho)n(we)n(v)o(er)m(,)f(there)i -(is)h(a)f(dif)n(ference:)f(A)h(Not_competent)396 1664 -y(from)f Fq(~url_of_id)g Fv(is)j(left)e(as)h(it)g(is,)g(b)n(ut)f(a)h -(Not_competent)c(from)i Fq(~channel_of_url)g Fv(is)i(con)m(v)o(erted)c -(to)396 1772 y(Not_resolv)n(able.)h(So)i(only)g Fq(~url_of_id)f -Fv(decides)h(which)f(URLs)i(are)f(accepted)g(by)f(the)i(resolv)o(er)e -(and)g(which)h(not.)396 1921 y(The)g(function)f Fq(~channel_of_url)f -Fv(must)i(return)f Fq(None)h Fv(as)h(encoding)d(if)j(the)f(def)o(ault)f -(mechanism)g(to)i(recognize)396 2029 y(the)f(encoding)f(should)g(be)h -(used.)g(It)g(must)g(return)f Fq(Some)44 b(e)21 b Fv(if)g(it)f(is)i -(already)d(kno)n(wn)f(that)j(the)f(encoding)e(of)i(the)396 -2137 y(channel)f(is)i Fq(e)p Fv(.)396 2287 y(If)f Fq(~auto_close)43 -b(=)i(true)20 b Fv(\(which)f(is)i(the)g(def)o(ault\),)e(the)h(channel)f -(is)i(closed)f(after)g(use.)g(If)g Fq(~auto_close)43 -b(=)396 2395 y(false)p Fv(,)20 b(the)g(channel)f(is)i(left)g(open.)396 -2544 y(Objects)f(of)g(this)g(class)h(contain)e(a)h(base)g(URL)g(relati) -n(v)o(e)f(to)h(which)g(relati)n(v)o(e)f(URLs)h(are)g(interpreted.)e -(When)i(creating)e(a)396 2652 y(ne)n(w)i(object,)g(you)f(can)h(specify) -f(the)i(base)f(URL)h(by)f(passing)f(it)i(as)g Fq(~base_url)e -Fv(ar)o(gument.)f(When)i(an)g(e)o(xisting)396 2760 y(object)g(is)h -(cloned,)e(the)h(base)g(URL)h(of)f(the)g(clone)g(is)h(the)f(URL)h(of)f -(the)g(original)f(object.)h(-)g(Note)g(that)g(the)h(term)f("base)396 -2868 y(URL")h(has)f(a)h(strict)g(de\002nition)e(in)h(RFC)i(1808.)396 -3089 y Fq(class)44 b(resolve_read_this_string)d(:)576 -3187 y(?id:ext_id)i(->)576 3284 y(?fixenc:encoding)f(->)576 -3381 y(string)h(->)755 3478 y(resolver)396 3669 y Fv(Reads)21 -b(from)e(the)h(passed)g(string.)g(If)g(the)g Fq(~id)h -Fv(ar)o(gument)c(is)k(passed)g(to)f(the)g(object,)g(the)g(created)f -(resolv)o(er)g(accepts)396 3777 y(only)h(this)g(ID.)g(Otherwise)g(all)h -(IDs)g(are)f(accepted.)f(-)h(Once)g(the)g(resolv)o(er)f(has)i(been)e -(cloned,)g(it)i(does)f(not)g(accept)g(an)o(y)396 3885 -y(ID.)g(This)h(means)f(that)g(this)h(resolv)o(er)e(cannot)g(handle)g -(inner)g(references)g(to)h(e)o(xternal)f(entities.)i(Note)f(that)g(you) -f(can)396 3993 y(combine)g(this)i(resolv)o(er)e(with)h(another)f -(resolv)o(er)g(that)h(can)g(handle)f(inner)g(references)g(\(such)h(as)h -(resolv)o(e_as_\002le\);)396 4101 y(see)g(class)g('combine')d(belo)n(w) --5 b(.)19 b(-)i(If)f(you)f(pass)i(the)f Fq(~fixenc)f -Fv(ar)o(gument,)f(the)i(encoding)e(of)i(the)g(string)g(is)h(set)g(to)g -(the)396 4209 y(passed)f(v)n(alue,)g(re)o(gardless)e(of)i(an)o(y)g -(auto-recognition)c(or)k(an)o(y)f(XML)i(declaration.)396 -4430 y Fq(class)44 b(resolve_read_any_string)d(:)576 -4527 y(string_of_id:\(ext_id)g(->)k(\(string)e(*)i(encoding)e -(option\)\))h(->)755 4625 y(resolver)p Black 3800 5278 -a Fr(79)p Black eop -%%Page: 80 80 -80 79 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(This)h(resolv)o(er)e -(calls)h(the)h(function)d Fq(~string_of_id)h Fv(to)h(get)g(the)g -(string)g(for)g(the)g(passed)g Fq(ext_id)p Fv(.)g(This)g(function)396 -687 y(must)g(either)g(return)f(the)i(string)e(and)h(the)g(encoding,)e -(or)i(it)h(must)f(f)o(ail)h(with)f(Not_competent.)e(The)h(function)g -(must)396 795 y(return)g Fq(None)h Fv(as)h(encoding)d(if)j(the)f(def)o -(ault)g(mechanism)e(to)j(recognize)d(the)i(encoding)f(should)g(be)h -(used.)g(It)g(must)396 903 y(return)f Fq(Some)44 b(e)21 -b Fv(if)g(it)f(is)i(already)d(kno)n(wn)f(that)j(the)f(encoding)e(of)i -(the)g(string)g(is)h Fq(e)p Fv(.)396 1124 y Fq(class)44 -b(resolve_as_file)f(:)576 1222 y(?file_prefix:[)f(`Not_recognized)g(|)j -(`Allowed)f(|)g(`Required)g(])g(->)576 1319 y(?host_prefix:[)e -(`Not_recognized)g(|)j(`Allowed)f(|)g(`Required)g(])g(->)576 -1416 y(?system_encoding:encoding)c(->)576 1513 y(?url_of_id:\(ext_id)h -(->)k(Neturl.url\))e(->)576 1610 y(?channel_of_url:)f(\(Neturl.url)h -(->)h(\(in_channel)f(*)i(encoding)e(option\)\))h(->)576 -1707 y(unit)g(->)755 1804 y(resolver)396 1995 y Fv(Reads)21 -b(from)e(the)h(local)g(\002le)h(system.)f(Ev)o(ery)f(\002le)i(name)f -(is)h(interpreted)d(as)j(\002le)g(name)f(of)f(the)i(local)f(\002le)h -(system,)f(and)396 2103 y(the)g(referred)f(\002le)i(is)g(read.)396 -2253 y(The)f(full)g(form)f(of)h(a)h(\002le)g(URL)g(is:)g -(\002le://host/path,)e(where)h('host')f(speci\002es)i(the)f(host)g -(system)g(where)g(the)g(\002le)396 2361 y(identi\002ed)g('path')f -(resides.)h(host)g(=)g("")h(or)f(host)g(=)h("localhost")e(are)h -(accepted;)f(other)h(v)n(alues)f(will)i(raise)396 2468 -y(Not_competent.)d(The)i(standard)f(for)g(\002le)i(URLs)g(is)g -(de\002ned)e(in)i(RFC)g(1738.)396 2618 y(Option)f Fq(~file_prefix)p -Fv(:)e(Speci\002es)j(ho)n(w)f(the)g("\002le:")h(pre\002x)e(of)h(\002le) -h(names)f(is)h(handled:)p Black 396 2850 a Ft(\225)p -Black 60 w Fq(`Not_recognized:)p Fv(The)c(pre\002x)j(is)h(not)f -(recognized.)p Black 396 2958 a Ft(\225)p Black 60 w -Fq(`Allowed:)g Fv(The)f(pre\002x)h(is)h(allo)n(wed)e(b)n(ut)i(not)f -(required)e(\(the)i(def)o(ault\).)p Black 396 3066 a -Ft(\225)p Black 60 w Fq(`Required:)f Fv(The)h(pre\002x)g(is)h -(required.)396 3257 y(Option)f Fq(~host_prefix:)e Fv(Speci\002es)j(ho)n -(w)e(the)i("//host")f(phrase)f(of)h(\002le)h(names)f(is)h(handled:)p -Black 396 3490 a Ft(\225)p Black 60 w Fq(`Not_recognized:)p -Fv(The)c(pre\002x)j(is)h(not)f(recognized.)p Black 396 -3598 a Ft(\225)p Black 60 w Fq(`Allowed:)g Fv(The)f(pre\002x)h(is)h -(allo)n(wed)e(b)n(ut)i(not)f(required)e(\(the)i(def)o(ault\).)p -Black 396 3706 a Ft(\225)p Black 60 w Fq(`Required:)f -Fv(The)h(pre\002x)g(is)h(required.)396 3896 y(Option)f -Fq(~system_encoding:)e Fv(Speci\002es)i(the)g(encoding)e(of)i(\002le)h -(names)f(of)g(the)g(local)g(\002le)h(system.)f(Def)o(ault:)396 -4004 y(UTF-8.)396 4154 y(Options)g Fq(~url_of_id)p Fv(,)f -Fq(~channel_of_url)p Fv(:)f(Not)i(for)g(the)g(casual)g(user!)396 -4376 y Fq(class)44 b(combine)g(:)576 4473 y(?prefer:resolver)e(->)576 -4570 y(resolver)h(list)h(->)755 4667 y(resolver)p Black -3800 5278 a Fr(80)p Black eop -%%Page: 81 81 -81 80 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(Combines)g(se)n(v)o -(eral)f(resolv)o(er)g(objects.)h(If)g(a)h(concrete)e(entity)g(with)i -(an)f Fq(ext_id)g Fv(is)h(to)f(be)g(opened,)f(the)h(combined)396 -687 y(resolv)o(er)f(tries)i(the)f(contained)f(resolv)o(ers)g(in)h(turn) -g(until)g(a)g(resolv)o(er)f(accepts)h(opening)f(the)h(entity)g(\(i.e.)g -(it)g(does)g(not)396 795 y(raise)h(Not_competent)c(on)j(open_in\).)396 -944 y(Clones:)h(If)f(the)g('clone')f(method)g(is)i(in)m(v)n(ok)o(ed)d -(before)h('open_in',)e(all)k(contained)e(resolv)o(ers)g(are)h(cloned)f -(separately)396 1052 y(and)h(again)f(combined.)f(If)i(the)g('clone')f -(method)g(is)i(in)m(v)n(ok)o(ed)e(after)g('open_in')f(\(i.e.)i(while)g -(the)g(resolv)o(er)f(is)i(open\),)396 1160 y(additionally)e(the)h -(clone)f(of)h(the)h(acti)n(v)o(e)e(resolv)o(er)g(is)i(\003agged)f(as)g -(being)g(preferred,)d(i.e.)k(it)f(is)i(tried)e(\002rst.)-2 -1662 y Fx(4.3.)39 b(The)g(DTD)g(c)m(lasses)396 1841 y -Fr(Sorry)-5 b(,)21 b(not)f(yet)g(written.)h(P)-7 b(erhaps)20 -b(the)g(interface)g(de\002nition)e(of)j(Pxp_dtd)d(e)n(xpr)m(esses)j -(the)f(same:)396 2063 y Fq(\(****************************************)o -(******)o(******)o(******)o(******)o(*****)o(*\))396 -2160 y(\(*)3048 b(*\))396 2257 y(\(*)45 b(Pxp_dtd:)2643 -b(*\))396 2354 y(\(*)224 b(Object)44 b(model)g(of)g(document)g(type)g -(declarations)939 b(*\))396 2452 y(\(*)3048 b(*\))396 -2549 y(\(****************************************)o(******)o(******)o -(******)o(******)o(*****)o(*\))396 2743 y(\(*)45 b -(======================================)o(======)o(======)o(======)o -(======)o(=====)o(===)441 2840 y(*)g(OVERVIEW)441 2937 -y(*)441 3034 y(*)g(class)f(dtd)g(...............)e(represents)i(the)g -(whole)g(DTD,)g(including)f(element)441 3132 y(*)1210 -b(declarations,)43 b(entity)h(declarations,)f(notation)441 -3229 y(*)1210 b(declarations,)43 b(and)h(processing)g(instructions)441 -3326 y(*)h(class)f(dtd_element)f(.......)g(represents)h(an)g(element)g -(declaration)f(consisting)441 3423 y(*)1210 b(of)45 b(a)g(content)e -(model)h(and)h(an)f(attribute)f(list)441 3520 y(*)1210 -b(declaration)441 3617 y(*)45 b(class)f(dtd_notation)f(......)g -(represents)h(a)g(notation)g(declaration)441 3714 y(*)h(class)f -(proc_instruction)e(..)i(represents)g(a)g(processing)f(instruction)441 -3811 y(*)i(======================================)o(======)o(======)o -(======)o(======)o(=====)o(===)441 3909 y(*)441 4006 -y(*\))396 4297 y(class)f(dtd)h(:)486 4394 y(\(*)f(Creation:)531 -4491 y(*)134 b(new)44 b(dtd)531 4589 y(*)g(creates)g(a)h(new,)f(empty)g -(DTD)g(object)g(without)g(any)g(declaration,)f(without)g(a)i(root)531 -4686 y(*)f(element,)g(without)g(an)g(ID.)531 4783 y(*\))p -Black 3800 5278 a Fr(81)p Black eop -%%Page: 82 82 -82 81 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 486 579 a Fq -(Pxp_types.collect_warnings)40 b(-)p Fo(>)486 676 y Fq -(Pxp_types.rep_encoding)h(-)p Fo(>)486 773 y Fq(object)576 -870 y(method)i(root)i(:)f(string)g(option)665 967 y(\(*)h(get)f(the)g -(name)h(of)f(the)g(root)h(element)e(if)i(present)e(*\))576 -1162 y(method)g(set_root)h(:)h(string)e(-)p Fo(>)i Fq(unit)665 -1259 y(\(*)g(set)f(the)g(name)h(of)f(the)g(root)h(element.)e(This)h -(method)g(can)g(be)h(invoked)710 1356 y(*)g(only)f(once)710 -1453 y(*\))576 1647 y(method)f(id)i(:)g(Pxp_types.dtd_id)d(option)665 -1745 y(\(*)j(get)f(the)g(identifier)g(for)g(this)g(DTD)g(*\))576 -1939 y(method)f(set_id)h(:)h(Pxp_types.dtd_id)d(-)p Fo(>)i -Fq(unit)665 2036 y(\(*)h(set)f(the)g(identifier.)f(This)i(method)e(can) -i(be)f(invoked)g(only)g(once)g(*\))576 2230 y(method)f(encoding)h(:)h -(Pxp_types.rep_encoding)665 2327 y(\(*)g(returns)e(the)i(encoding)e -(used)h(for)h(character)e(representation)g(*\))576 2619 -y(method)g(allow_arbitrary)g(:)h(unit)665 2716 y(\(*)h(After)f(this)g -(method)g(has)g(been)g(invoked,)g(the)g(ob-)396 2813 -y(ject)g(changes)g(its)g(behaviour:)710 2910 y(*)h(-)f(elements)g(and)g -(notations)g(that)g(have)g(not)g(been)g(added)g(may)h(be)f(used)g(in)h -(an)710 3007 y(*)134 b(arbitrary)44 b(way;)g(the)g(methods)g("element") -f(and)i("notation")e(indicate)g(this)710 3104 y(*)134 -b(by)45 b(raising)f(Undeclared)f(instead)g(of)i(Validation_error.)710 -3202 y(*\))576 3396 y(method)e(disallow_arbitrary)f(:)j(unit)576 -3590 y(method)e(arbitrary_allowed)f(:)j(bool)665 3687 -y(\(*)g(Returns)e(whether)h(arbitrary)f(contents)h(are)g(allowed)g(or)g -(not.)h(*\))576 3882 y(method)e(standalone_declaration)f(:)i(bool)665 -3979 y(\(*)h(Whether)e(there)h(is)h(a)g('standalone')d(declaration)h -(or)i(not.)f(Strictly)710 4076 y(*)h(speaking,)e(this)h(declaration)f -(is)i(not)f(part)g(of)h(the)f(DTD,)g(but)h(it)f(is)710 -4173 y(*)h(included)e(here)h(because)g(of)h(practical)e(reasons.)710 -4270 y(*)i(If)f(not)h(set,)f(this)g(property)f(defaults)h(to)g -('false'.)710 4367 y(*\))576 4561 y(method)f -(set_standalone_declaration)e(:)k(bool)f(-)p Fo(>)g Fq(unit)665 -4659 y(\(*)h(Sets)f(the)g('standalone')f(declaration.)g(*\))p -Black 3800 5278 a Fr(82)p Black eop -%%Page: 83 83 -83 82 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 576 579 a Fq(method)43 -b(add_element)g(:)i(dtd_element)e(-)p Fo(>)h Fq(unit)665 -676 y(\(*)h(add)f(the)g(given)g(element)g(declaration)f(to)i(this)f -(DTD.)g(Raises)g(Not_found)710 773 y(*)h(if)f(there)g(is)h(already)e -(an)i(element)f(declaration)f(with)h(the)g(same)g(name.)710 -870 y(*\))576 1065 y(method)f(add_gen_entity)g(:)i(Pxp_entity.entity)d -(-)p Fo(>)i Fq(bool)g(-)p Fo(>)g Fq(unit)665 1162 y(\(*)h -(add_gen_entity)d(e)j(extdecl:)710 1259 y(*)g(add)f(the)g(entity)g('e') -h(as)f(general)g(entity)g(to)g(this)g(DTD)h(\(general)e(entities)710 -1356 y(*)i(are)f(those)g(represented)f(by)i(&name;\).)e(If)i(there)f -(is)g(already)g(a)g(declaration)710 1453 y(*)h(with)f(the)g(same)g -(name,)g(the)h(second)f(definition)f(is)h(ignored;)g(as)g(excep-)396 -1550 y(tion)g(from)710 1647 y(*)h(this)f(rule,)g(entities)f(with)i -(names)f("lt",)g("gt",)g("amp",)f("quot",)h(and)g("apos")710 -1745 y(*)h(may)f(only)g(be)h(redeclared)e(with)h(a)h(definition)e(that) -h(is)h(equivalent)e(to)h(the)710 1842 y(*)h(standard)e(definition;)g -(otherwise)h(a)g(Validation_error)e(is)j(raised.)710 -1939 y(*)710 2036 y(*)g('extdecl':)e('true')h(indicates)f(that)h(the)h -(entity)e(declaration)g(occurs)h(in)710 2133 y(*)h(an)f(external)g -(entity.)f(\(Used)h(for)h(the)f(standalone)f(check.\))710 -2230 y(*\))576 2424 y(method)g(add_par_entity)g(:)i(Pxp_entity.entity)d -(-)p Fo(>)i Fq(unit)665 2522 y(\(*)h(add)f(the)g(given)g(entity)g(as)h -(parameter)e(entity)h(to)g(this)h(DTD)f(\(parameter)710 -2619 y(*)h(entities)e(are)i(those)f(represented)f(by)h(\045name;\).)g -(If)g(there)g(is)h(already)e(a)710 2716 y(*)i(declaration)e(with)h(the) -g(same)g(name,)g(the)h(second)f(definition)f(is)h(ignored.)710 -2813 y(*\))576 3007 y(method)f(add_notation)g(:)i(dtd_notation)e(-)p -Fo(>)h Fq(unit)665 3104 y(\(*)h(add)f(the)g(given)g(notation)g(to)g -(this)h(DTD.)f(If)g(there)g(is)h(al-)396 3202 y(ready)f(a)h -(declaration)710 3299 y(*)g(with)f(the)g(same)g(name,)g(a)h -(Validation_error)d(is)j(raised.)710 3396 y(*\))576 3590 -y(method)e(add_pinstr)h(:)g(proc_instruction)e(-)p Fo(>)j -Fq(unit)665 3687 y(\(*)g(add)f(the)g(given)g(processing)g(instruction)f -(to)h(this)g(DTD.)g(*\))576 3882 y(method)f(element)h(:)h(string)f(-)p -Fo(>)g Fq(dtd_element)665 3979 y(\(*)h(looks)f(up)g(the)h(element)e -(declaration)g(with)h(the)h(given)f(name.)g(Raises)710 -4076 y(*)h(Validation_error)d(if)i(the)h(element)e(can-)396 -4173 y(not)i(be)f(found.)g(\(If)g("allow_arbitrary")710 -4270 y(*)h(has)f(been)g(invoked)g(before,)g(Unrestricted)e(is)j(raised) -f(instead.\))710 4367 y(*\))576 4561 y(method)f(element_names)g(:)i -(string)f(list)665 4659 y(\(*)h(returns)e(the)i(list)f(of)g(the)h -(names)f(of)g(all)h(element)e(declarations.)g(*\))576 -4853 y(method)g(gen_entity)h(:)g(string)g(-)p Fo(>)g -Fq(\(Pxp_entity.entity)e(*)j(bool\))p Black 3800 5278 -a Fr(83)p Black eop -%%Page: 84 84 -84 83 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 665 579 a Fq(\(*)45 -b(let)f(e,)h(extdecl)e(=)i(obj)f(#)h(gen_entity)e(n:)710 -676 y(*)i(looks)f(up)g(the)h(general)e(entity)h('e')g(with)h(the)f -(name)g('n'.)g(Raises)710 773 y(*)h(WF_error)e(if)i(the)f(entity)g -(cannot)g(be)g(found.)710 870 y(*)h('extdecl':)e(indicates)g(whether)h -(the)g(entity)g(declaration)f(occured)h(in)g(an)710 967 -y(*)h(external)e(entity.)710 1065 y(*\))576 1259 y(method)g -(gen_entity_names)g(:)h(string)g(list)665 1356 y(\(*)h(returns)e(the)i -(list)f(of)g(all)h(general)e(entity)h(names)g(*\))576 -1550 y(method)f(par_entity)h(:)g(string)g(-)p Fo(>)g -Fq(Pxp_entity.entity)665 1647 y(\(*)h(looks)f(up)g(the)h(parameter)e -(entity)h(with)g(the)g(given)g(name.)g(Raises)710 1745 -y(*)h(WF_error)e(if)i(the)f(entity)g(cannot)g(be)g(found.)710 -1842 y(*\))576 2036 y(method)f(par_entity_names)g(:)h(string)g(list)665 -2133 y(\(*)h(returns)e(the)i(list)f(of)g(all)h(parameter)e(entity)h -(names)g(*\))576 2327 y(method)f(notation)h(:)h(string)e(-)p -Fo(>)i Fq(dtd_notation)665 2424 y(\(*)g(looks)f(up)g(the)h(notation)e -(declaration)g(with)h(the)h(given)f(name.)g(Raises)710 -2522 y(*)h(Validation_error)d(if)i(the)h(notation)e(can-)396 -2619 y(not)i(be)f(found.)g(\(If)g("allow_arbitrary")710 -2716 y(*)h(has)f(been)g(invoked)g(before,)g(Unrestricted)e(is)j(raised) -f(instead.\))710 2813 y(*\))576 3007 y(method)f(notation_names)g(:)i -(string)e(list)665 3104 y(\(*)i(Returns)e(the)i(list)f(of)g(the)h -(names)f(of)g(all)h(added)f(notations)f(*\))576 3299 -y(method)g(pinstr)h(:)h(string)f(-)p Fo(>)g Fq(proc_instruction)e(list) -665 3396 y(\(*)j(looks)f(up)g(all)h(processing)e(instructions)g(with)h -(the)g(given)g(target.)710 3493 y(*)h(The)f("target")g(is)g(the)g -(identifier)g(following)f(")p Fo(<)p Fq(?".)710 3590 -y(*)i(Note:)f(It)g(is)h(not)f(possible)g(to)g(find)g(out)h(the)f(exact) -g(position)f(of)i(the)710 3687 y(*)g(processing)e(instruction.)710 -3784 y(*\))576 3979 y(method)g(pinstr_names)g(:)i(string)f(list)665 -4076 y(\(*)h(Returns)e(the)i(list)f(of)g(the)h(names)f(\(targets\))f -(of)i(all)f(added)g(pinstrs)f(*\))576 4270 y(method)g(validate)h(:)h -(unit)665 4367 y(\(*)g(ensures)e(that)i(the)f(DTD)g(is)h(valid.)f(This) -g(method)g(is)g(optimized)f(such)h(that)710 4464 y(*)h(actual)f -(validation)f(is)h(only)g(performed)g(if)g(DTD)h(has)f(changed.)710 -4561 y(*)h(If)f(the)h(DTD)f(is)g(invalid,)g(mostly)g(a)g -(Validation_error)f(is)h(raised,)710 4659 y(*)h(but)f(other)g -(exceptions)f(are)i(possible,)e(too.)710 4756 y(*\))p -Black 3800 5278 a Fr(84)p Black eop -%%Page: 85 85 -85 84 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 576 579 a Fq(method)43 -b(only_deterministic_models)e(:)k(unit)665 676 y(\(*)g(Succeeds)e(if)i -(all)f(regexp)g(content)g(models)f(are)i(deterministic.)710 -773 y(*)g(Otherwise)e(Validation_error.)710 870 y(*\))576 -1065 y(method)g(write)h(:)h(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(Pxp_types.encoding)e(-)p Fo(>)j Fq(bool)f(-)396 -1162 y Fo(>)h Fq(unit)665 1259 y(\(*)g(write_compact_as_latin1)c(os)j -(enc)h(doctype:)710 1356 y(*)g(Writes)f(the)g(DTD)g(as)h('enc'-encoded) -d(string)i(to)h('os'.)f(If)g('doctype',)f(a)710 1453 -y(*)i(DTD)f(like)g Fo(<)p Fq(!DOCTYPE)f(root)i([)f(...)h(])p -Fo(>)f Fq(is)g(written.)g(If)g('not)h(doctype',)710 1550 -y(*)g(only)f(the)g(declarations)f(are)h(written)g(\(the)g(material)g -(within)g(the)710 1647 y(*)h(square)f(brackets\).)710 -1745 y(*\))576 1939 y(method)f(write_compact_as_latin1)e(:)k -(Pxp_types.output_stream)c(-)p Fo(>)j Fq(bool)h(-)p Fo(>)f -Fq(unit)665 2036 y(\(*)h(DEPRECATED)e(METHOD;)h(included)f(only)h(to)h -(keep)f(compatibility)f(with)710 2133 y(*)i(older)f(versions)f(of)i -(the)f(parser)710 2230 y(*\))576 2522 y -(\(*---------------------------*\))576 2619 y(method)f(invalidate)h(:)g -(unit)665 2716 y(\(*)h(INTERNAL)e(METHOD)h(*\))576 2813 -y(method)f(warner)h(:)h(Pxp_types.collect_warnings)665 -2910 y(\(*)g(INTERNAL)e(METHOD)h(*\))486 3007 y(end)396 -3396 y(\(*)h(--------------------------------------)o(------)o(---)39 -b(*\))396 3590 y(and)45 b(dtd_element)e(:)h(dtd)h(-)p -Fo(>)f Fq(string)g(-)p Fo(>)486 3687 y Fq(\(*)g(Creation:)531 -3784 y(*)134 b(new)44 b(dtd_element)f(init_dtd)h(init_name:)531 -3882 y(*)g(creates)g(a)h(new)f(dtd_element)f(object)h(for)g(init_dtd)g -(with)g(init_name.)531 3979 y(*)g(The)h(strings)e(are)i(represented)e -(in)h(the)h(same)f(encoding)f(as)i(init_dtd.)531 4076 -y(*\))486 4173 y(object)576 4367 y(method)e(name)i(:)f(string)665 -4464 y(\(*)h(returns)e(the)i(name)f(of)g(the)h(declared)e(element)h -(*\))576 4659 y(method)f(externally_declared)f(:)j(bool)665 -4756 y(\(*)g(returns)e(whether)h(the)g(element)g(declaration)f(occurs)h -(in)g(an)h(external)710 4853 y(*)g(entity.)p Black 3800 -5278 a Fr(85)p Black eop -%%Page: 86 86 -86 85 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 710 579 a Fq(*\))576 -773 y(method)43 b(content_model)g(:)i(Pxp_types.content_model_type)665 -870 y(\(*)g(get)f(the)g(content)g(model)g(of)h(this)f(element)f -(declaration,)g(or)i(Unspecified)e(*\))576 1065 y(method)g(content_dfa) -g(:)i(Pxp_dfa.dfa_definition)c(option)665 1162 y(\(*)k(return)f(the)g -(DFA)g(of)h(the)f(content)g(model)g(if)g(there)g(is)h(a)f(DFA,)h(or)f -(None.)710 1259 y(*)h(A)f(DFA)h(exists)f(only)g(for)g(regexp)g(style)g -(content)g(models)f(which)h(are)710 1356 y(*)h(deterministic.)710 -1453 y(*\))576 1647 y(method)e(set_cm_and_extdecl)f(:)j -(Pxp_types.content_model_type)40 b(-)p Fo(>)k Fq(bool)h(-)p -Fo(>)f Fq(unit)665 1745 y(\(*)h(set_cm_and_extdecl)d(cm)i(extdecl:)710 -1842 y(*)h(set)f(the)g(content)g(model)g(to)h('cm'.)f(Once)g(the)g -(content)g(model)g(is)g(not)710 1939 y(*)h(Unspecified,)e(it)h(cannot)g -(be)g(set)h(to)f(a)h(different)e(value)h(again.)710 2036 -y(*)h(Furthermore,)e(it)h(is)h(set)f(whether)g(the)g(element)g(occurs)f -(in)i(an)f(external)710 2133 y(*)h(entity)f(\('extdecl'\).)710 -2230 y(*\))576 2424 y(method)f(encoding)h(:)h(Pxp_types.rep_encoding) -665 2522 y(\(*)g(Return)f(the)g(encoding)f(of)i(the)f(strings)g(*\))576 -2716 y(method)f(allow_arbitrary)g(:)h(unit)665 2813 y(\(*)h(After)f -(this)g(method)g(has)g(been)g(invoked,)g(the)g(ob-)396 -2910 y(ject)g(changes)g(its)g(behaviour:)710 3007 y(*)h(-)f(attributes) -g(that)g(have)g(not)g(been)g(added)g(may)h(be)f(used)g(in)h(an)710 -3104 y(*)134 b(arbitrary)44 b(way;)g(the)g(method)g("attribute")f -(indicates)g(this)710 3202 y(*)134 b(by)45 b(raising)f(Undeclared)f -(instead)g(of)i(Validation_error.)710 3299 y(*\))576 -3493 y(method)e(disallow_arbitrary)f(:)j(unit)576 3687 -y(method)e(arbitrary_allowed)f(:)j(bool)665 3784 y(\(*)g(Returns)e -(whether)h(arbitrary)f(attributes)h(are)g(allowed)g(or)g(not.)g(*\))576 -3979 y(method)f(attribute)h(:)g(string)g(-)p Fo(>)1517 -4076 y Fq(Pxp_types.att_type)e(*)j(Pxp_types.att_default)665 -4173 y(\(*)g(get)f(the)g(type)h(and)f(default)g(value)g(of)g(a)h -(declared)e(attribute,)g(or)i(raise)710 4270 y(*)g(Validation_error)d -(if)i(the)h(attribute)e(does)h(not)h(exist.)710 4367 -y(*)g(If)f('arbitrary_allowed',)e(the)i(exception)f(Undeclared)h(is)g -(raised)g(instead)710 4464 y(*)h(of)f(Validation_error.)710 -4561 y(*\))576 4756 y(method)f -(attribute_violates_standalone_declaration)38 b(:)1069 -4853 y(string)44 b(-)p Fo(>)g Fq(string)g(option)g(-)p -Fo(>)g Fq(bool)p Black 3798 5278 a Fr(86)p Black eop -%%Page: 87 87 -87 86 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 665 579 a Fq(\(*)45 -b(attribute_violates_standalone_declarat)o(ion)39 b(name)44 -b(v:)710 676 y(*)h(Checks)f(whether)f(the)i(attribute)e('name')h -(violates)f(the)i("standalone")710 773 y(*)g(declaration)e(if)h(it)h -(has)f(value)g('v'.)710 870 y(*)h(The)f(method)g(returns)g(true)g(if:) -710 967 y(*)h(-)f(The)h(attribute)e(declaration)g(occurs)h(in)g(an)h -(external)e(entity,)710 1065 y(*)i(and)f(if)h(one)f(of)g(the)h(two)f -(conditions)f(holds:)710 1162 y(*)i(-)f(v)h(=)g(None,)f(and)g(there)g -(is)h(a)f(default)g(for)g(the)h(attribute)e(value)710 -1259 y(*)i(-)f(v)h(=)g(Some)f(s,)g(and)h(the)f(type)g(of)h(the)f -(attribute)f(is)i(not)f(CDATA,)710 1356 y(*)134 b(and)45 -b(s)f(changes)g(if)h(normalized)e(according)g(to)i(the)f(rules)g(of)g -(the)710 1453 y(*)134 b(attribute)44 b(type.)710 1550 -y(*)710 1647 y(*)h(The)f(method)g(raises)g(Validation_error)e(if)i(the) -h(attribute)e(does)h(not)g(exist.)710 1745 y(*)h(If)f -('arbitrary_allowed',)e(the)i(exception)f(Undeclared)h(is)g(raised)g -(instead)710 1842 y(*)h(of)f(Validation_error.)710 1939 -y(*\))576 2133 y(method)f(attribute_names)g(:)h(string)g(list)665 -2230 y(\(*)h(get)f(the)g(list)h(of)f(all)g(declared)g(attributes)f(*\)) -576 2424 y(method)g(names_of_required_attributes)e(:)j(string)g(list) -665 2522 y(\(*)h(get)f(the)g(list)h(of)f(all)g(attributes)g(that)g(are) -g(specified)f(as)i(required)710 2619 y(*)g(attributes)710 -2716 y(*\))576 2910 y(method)e(id_attribute_name)f(:)j(string)f(option) -665 3007 y(\(*)h(Returns)e(the)i(name)f(of)g(the)h(attribute)e(with)h -(type)g(ID,)h(or)f(None.)g(*\))576 3202 y(method)f -(idref_attribute_names)f(:)i(string)g(list)665 3299 y(\(*)h(Returns)e -(the)i(names)f(of)g(the)h(attributes)e(with)h(type)g(IDREF)g(or)h -(IDREFS.)e(*\))576 3493 y(method)g(add_attribute)g(:)i(string)f(-)p -Fo(>)1607 3590 y Fq(Pxp_types.att_type)e(-)p Fo(>)531 -3687 y Fq(Pxp_types.att_default)f(-)p Fo(>)531 3784 y -Fq(bool)j(-)p Fo(>)620 3882 y Fq(unit)665 3979 y(\(*)h(add_attribute)d -(name)j(type)f(default)f(extdecl:)710 4076 y(*)i(add)f(an)h(attribute)e -(declaration)g(for)h(an)h(attribute)e(with)h(the)h(given)e(name,)710 -4173 y(*)i(type,)f(and)g(default)g(value.)g(If)g(there)g(is)h(more)f -(than)g(one)g(declaration)f(for)710 4270 y(*)i(an)f(attribute)g(name,)g -(the)g(first)g(declara-)396 4367 y(tion)g(counts;)g(the)g(other)g -(declarations)710 4464 y(*)h(are)f(ignored.)710 4561 -y(*)h('extdecl':)e(if)h(true,)g(the)h(attribute)e(declaration)g(occurs) -h(in)g(an)h(external)710 4659 y(*)g(entity.)e(This)i(property)e(is)i -(used)f(to)g(check)g(the)h("standalone")d(attribute.)710 -4756 y(*\))p Black 3797 5278 a Fr(87)p Black eop -%%Page: 88 88 -88 87 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 576 579 a Fq(method)43 -b(validate)h(:)h(unit)665 676 y(\(*)g(checks)f(whether)f(this)h -(element)g(declaration)f(\(i.e.)h(the)g(content)g(model)g(and)710 -773 y(*)h(all)f(attribute)f(declarations\))g(is)i(valid)f(for)g(the)g -(associated)f(DTD.)710 870 y(*)i(Raises)f(mostly)f(Validation_error)g -(if)h(the)g(validation)g(fails.)710 967 y(*\))576 1162 -y(method)f(write)h(:)h(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(Pxp_types.encoding)e(-)p Fo(>)j Fq(unit)665 -1259 y(\(*)g(write_compact_as_latin1)c(os)j(enc:)710 -1356 y(*)h(Writes)f(the)g Fo(<)p Fq(!ELEMENT)f(...)h -Fo(>)h Fq(declaration)e(to)h('os')h(as)f('enc'-)396 1453 -y(encoded)g(string.)710 1550 y(*\))576 1745 y(method)f -(write_compact_as_latin1)e(:)k(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(unit)665 1842 y(\(*)h(DEPRECATED)e(METHOD;)h(included)f(only) -h(to)h(keep)f(compatibility)f(with)710 1939 y(*)i(older)f(versions)f -(of)i(the)f(parser)710 2036 y(*\))486 2133 y(end)396 -2327 y(\(*)h(--------------------------------------)o(------)o(---)39 -b(*\))396 2522 y(and)45 b(dtd_notation)d(:)j(string)f(-)p -Fo(>)g Fq(Pxp_types.ext_id)e(-)p Fo(>)j Fq(Pxp_types.rep_encoding)c(-)p -Fo(>)486 2619 y Fq(\(*)j(Creation:)531 2716 y(*)179 b(new)44 -b(dtd_notation)f(a_name)h(an_external_ID)e(init_encoding)531 -2813 y(*)i(creates)g(a)h(new)f(dtd_notation)f(object)h(with)g(the)g -(given)g(name)g(and)h(the)f(given)531 2910 y(*)g(external)g(ID.)531 -3007 y(*\))486 3104 y(object)576 3202 y(method)f(name)i(:)f(string)576 -3299 y(method)f(ext_id)h(:)h(Pxp_types.ext_id)576 3396 -y(method)e(encoding)h(:)h(Pxp_types.rep_encoding)576 -3590 y(method)e(write)h(:)h(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(Pxp_types.encoding)e(-)p Fo(>)j Fq(unit)665 -3687 y(\(*)g(write_compact_as_latin1)c(os)j(enc:)710 -3784 y(*)h(Writes)f(the)g Fo(<)p Fq(!NOTATION)f(...)h -Fo(>)h Fq(declaration)e(to)h('os')g(as)h('enc'-encoded)710 -3882 y(*)g(string.)710 3979 y(*\))576 4173 y(method)e -(write_compact_as_latin1)e(:)k(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(unit)665 4270 y(\(*)h(DEPRECATED)e(METHOD;)h(included)f(only) -h(to)h(keep)f(compatibility)f(with)710 4367 y(*)i(older)f(versions)f -(of)i(the)f(parser)710 4464 y(*\))486 4659 y(end)396 -4853 y(\(*)h(--------------------------------------)o(------)o(---)39 -b(*\))p Black 3800 5278 a Fr(88)p Black eop -%%Page: 89 89 -89 88 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 676 a Fq(and)45 -b(proc_instruction)d(:)i(string)g(-)p Fo(>)h Fq(string)e(-)p -Fo(>)i Fq(Pxp_types.rep_encoding)c(-)p Fo(>)486 773 y -Fq(\(*)j(Creation:)531 870 y(*)134 b(new)44 b(proc_instruction)f -(a_target)g(a_value)531 967 y(*)h(creates)g(a)h(new)f(proc_instruction) -e(object)i(with)g(the)h(given)f(target)f(string)h(and)531 -1065 y(*)g(the)h(given)f(value)g(string.)531 1162 y(*)g(Note:)g(A)h -(processing)e(instruction)g(is)i(written)e(as)i Fo(<)p -Fq(?target)e(value?)p Fo(>)p Fq(.)531 1259 y(*\))486 -1356 y(object)576 1453 y(method)g(target)h(:)h(string)576 -1550 y(method)e(value)h(:)h(string)576 1647 y(method)e(encoding)h(:)h -(Pxp_types.rep_encoding)576 1842 y(method)e(write)h(:)h -(Pxp_types.output_stream)c(-)p Fo(>)j Fq(Pxp_types.encoding)e(-)p -Fo(>)j Fq(unit)665 1939 y(\(*)g(write)f(os)g(enc:)710 -2036 y(*)h(Writes)f(the)g Fo(<)p Fq(?...?)p Fo(>)f Fq(PI)i(to)f('os')h -(as)f('enc'-encoded)f(string.)710 2133 y(*\))576 2327 -y(method)g(write_compact_as_latin1)e(:)k(Pxp_types.output_stream)c(-)p -Fo(>)j Fq(unit)665 2424 y(\(*)h(DEPRECATED)e(METHOD;)h(included)f(only) -h(to)h(keep)f(compatibility)f(with)710 2522 y(*)i(older)f(versions)f -(of)i(the)f(parser)710 2619 y(*\))576 2813 y(method)f(parse_pxp_option) -g(:)h(\(string)g(*)h(string)e(*)i(\(string)f(*)g(string\))g(list\))665 -2910 y(\(*)h(Parses)f(a)g(PI)h(containing)e(a)i(PXP)f(option.)g(Such)g -(PIs)g(are)g(formed)g(like:)710 3007 y(*)134 b Fo(<)p -Fq(?target)44 b(option-name)f(option-att="value")f(option-att="value")f -(...)k(?)p Fo(>)710 3104 y Fq(*)g(The)f(method)g(returns)g(a)g(triple) -710 3202 y(*)134 b(\(target,)44 b(option-name,)f([option-att,)g(value;) -g(...]\))710 3299 y(*)i(or)f(raises)g(Error.)710 3396 -y(*\))486 3590 y(end)396 3784 y(;;)-2 4286 y Fx(4.4.)39 -b(In)-6 b(v)l(oking)38 b(the)h(par)n(ser)396 4466 y Fv(Here)20 -b(a)h(description)e(of)h(Pxp_yacc.)-2 4794 y Fp(4.4.1.)35 -b(Defaults)p Black 3800 5278 a Fr(89)p Black eop -%%Page: 90 90 -90 89 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(The)g(follo)n(wing)f -(def)o(aults)g(are)i(a)n(v)n(ailable:)396 759 y Fq(val)45 -b(default_config)d(:)j(config)396 856 y(val)g(default_extension)d(:)i -(\('a)h(node)f(extension\))f(as)h('a)396 953 y(val)h(default_spec)d(:)j -(\('a)f(node)h(extension)e(as)h('a\))h(spec)-2 1406 y -Fp(4.4.2.)35 b(P)l(ar)n(sing)f(functions)396 1574 y Fv(In)20 -b(the)g(follo)n(wing,)f(the)h(term)g("closed)g(document")e(refers)h(to) -i(an)f(XML)g(structure)f(lik)o(e)396 1754 y Fo(<)p Fq(!DOCTYPE)43 -b(...)i([)f Fn(declarations)f Fq(])i Fo(>)396 1851 y(<)p -Fn(root)p Fo(>)396 1948 y Fq(...)396 2045 y Fo(<)p Fq(/)p -Fn(root)p Fo(>)396 2236 y Fv(The)20 b(term)g("fragment")e(refers)i(to)g -(an)g(XML)h(structure)e(lik)o(e)396 2416 y Fo(<)p Fn(root)p -Fo(>)396 2513 y Fq(...)396 2611 y Fo(<)p Fq(/)p Fn(root)p -Fo(>)396 2802 y Fv(i.e.)h(only)g(to)g(one)g(isolated)g(element)f -(instance.)396 3023 y Fq(val)45 b(parse_dtd_entity)d(:)i(config)g(->)h -(source)f(->)g(dtd)396 3214 y Fv(P)o(arses)21 b(the)f(declarations)f -(which)h(are)g(contained)e(in)j(the)f(entity)-5 b(,)19 -b(and)h(returns)f(them)h(as)h Fq(dtd)f Fv(object.)396 -3436 y Fq(val)45 b(extract_dtd_from_document_entity)39 -b(:)45 b(config)f(->)g(source)g(->)g(dtd)396 3627 y Fv(Extracts)20 -b(the)g(DTD)h(from)e(a)h(closed)g(document.)e(Both)i(the)h(internal)e -(and)h(the)g(e)o(xternal)f(subsets)h(are)h(e)o(xtracted)d(and)396 -3735 y(combined)g(to)i(one)f Fq(dtd)h Fv(object.)f(This)h(function)e -(does)h(not)h(parse)f(the)h(whole)f(document,)f(b)n(ut)i(only)e(the)i -(parts)g(that)g(are)396 3843 y(necessary)g(to)g(e)o(xtract)f(the)i -(DTD.)396 4064 y Fq(val)45 b(parse_document_entity)c(:)576 -4161 y(?transform_dtd:\(dtd)g(->)k(dtd\))f(->)576 4259 -y(?id_index:\('ext)e(index\))i(->)576 4356 y(config)f(->)576 -4453 y(source)g(->)576 4550 y('ext)h(spec)g(->)755 4647 -y('ext)g(document)p Black 3800 5278 a Fr(90)p Black eop -%%Page: 91 91 -91 90 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(P)o(arses)h(a)g(closed) -e(document)g(and)g(v)n(alidates)h(it)h(against)e(the)i(DTD)f(that)g(is) -h(contained)e(in)h(the)h(document)d(\(internal)396 687 -y(and)i(e)o(xternal)f(subsets\).)h(The)g(option)f Fq(~transform_dtd)f -Fv(can)i(be)g(used)g(to)g(transform)f(the)h(DTD)h(in)f(the)g(document,) -396 795 y(and)g(to)g(use)h(the)f(transformed)e(DTD)i(for)g(v)n -(alidation.)e(If)i Fq(~id_index)g Fv(is)h(speci\002ed,)e(an)h(inde)o(x) -f(of)h(all)h(ID)f(attrib)n(utes)h(is)396 903 y(created.)396 -1124 y Fq(val)45 b(parse_wfdocument_entity)c(:)576 1222 -y(config)i(->)576 1319 y(source)g(->)576 1416 y('ext)h(spec)g(->)755 -1513 y('ext)g(document)396 1704 y Fv(P)o(arses)21 b(a)g(closed)e -(document,)f(b)n(ut)j(checks)e(it)i(only)e(on)h(well-formedness.)396 -1926 y Fq(val)45 b(parse_content_entity)86 b(:)576 2023 -y(?id_index:\('ext)42 b(index\))i(->)576 2120 y(config)f(->)576 -2217 y(source)g(->)576 2314 y(dtd)h(->)576 2411 y('ext)g(spec)g(->)755 -2508 y('ext)g(node)396 2699 y Fv(P)o(arses)21 b(a)g(fragment,)d(and)h -(v)n(alidates)h(the)g(element.)396 2921 y Fq(val)45 b -(parse_wfcontent_entity)c(:)576 3018 y(config)i(->)576 -3115 y(source)g(->)576 3212 y('ext)h(spec)g(->)755 3310 -y('ext)g(node)396 3500 y Fv(P)o(arses)21 b(a)g(fragment,)d(b)n(ut)i -(checks)g(it)g(only)g(on)g(well-formedness.)-2 3870 y -Fp(4.4.3.)35 b(Con\002guration)f(options)396 4110 y Fq(type)44 -b(config)g(=)576 4207 y({)g(warner)g(:)h(collect_warnings;)665 -4304 y(errors_with_line_numbers)c(:)k(bool;)665 4401 -y(enable_pinstr_nodes)d(:)j(bool;)665 4499 y(enable_super_root_node)c -(:)k(bool;)665 4596 y(enable_comment_nodes)d(:)i(bool;)665 -4693 y(encoding)g(:)g(rep_encoding;)665 4790 y -(recognize_standalone_declaration)c(:)k(bool;)p Black -3800 5278 a Fr(91)p Black eop -%%Page: 92 92 -92 91 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 665 579 a Fq -(store_element_positions)41 b(:)k(bool;)665 676 y(idref_pass)e(:)i -(bool;)665 773 y(validate_by_dfa)e(:)h(bool;)665 870 -y(accept_only_deterministic_models)c(:)k(bool;)665 967 -y(...)576 1065 y(})p Black 396 1422 a Ft(\225)p Black -60 w Fq(warner:)p Fv(The)19 b(parser)h(prints)f(w)o(arnings)h(by)f(in)m -(v)n(oking)f(the)j(method)d Fq(warn)j Fv(for)e(this)i(w)o(arner)e -(object.)h(\(Def)o(ault:)f(all)479 1530 y(w)o(arnings)h(are)g -(dropped\))p Black 396 1637 a Ft(\225)p Black 60 w Fq -(errors_with_line_numbers:)p Fv(If)c(true,)k(errors)f(contain)g(line)i -(numbers;)d(if)j(f)o(alse,)f(errors)g(contain)f(only)g(byte)479 -1745 y(positions.)h(The)g(latter)g(mode)f(is)i(f)o(aster)-5 -b(.)21 b(\(Def)o(ault:)e(true\))p Black 396 1853 a Ft(\225)p -Black 60 w Fq(enable_pinstr_nodes:)p Fv(If)e(true,)j(the)g(parser)f -(creates)i(e)o(xtra)e(nodes)g(for)h(processing)f(instructions.)g(If)h -(f)o(alse,)479 1961 y(processing)f(instructions)g(are)h(simply)g(added) -f(to)i(the)f(element)f(or)h(document)f(surrounding)e(the)j -(instructions.)479 2069 y(\(Def)o(ault:)g(f)o(alse\))p -Black 396 2177 a Ft(\225)p Black 60 w Fq(enable_super_root_node:)p -Fv(If)c(true,)k(the)g(parser)g(creates)g(an)g(e)o(xtra)g(node)f(which)g -(is)j(the)e(parent)f(of)h(the)g(root)479 2285 y(of)g(the)g(document)f -(tree.)h(This)g(node)f(is)i(called)f(super)g(root;)f(it)i(is)g(an)g -(element)e(with)i(type)e Fq(T_super_root)p Fv(.)g(-)h(If)479 -2393 y(there)g(are)g(processing)f(instructions)g(outside)h(the)g(root)f -(element)h(and)g(outside)f(the)i(DTD,)f(the)o(y)f(are)h(added)f(to)i -(the)479 2501 y(super)f(root)f(instead)h(of)g(the)g(document.)e(-)j(If) -f(f)o(alse,)g(the)g(super)g(root)g(node)f(is)i(not)f(created.)f(\(Def)o -(ault:)h(f)o(alse\))p Black 396 2609 a Ft(\225)p Black -60 w Fq(enable_comment_nodes:)p Fv(If)d(true,)i(the)i(parser)e(creates) -h(nodes)g(for)f(comments)g(with)i(type)f Fq(T_comment)p -Fv(;)f(if)479 2717 y(f)o(alse,)i(such)f(nodes)f(are)h(not)g(created.)f -(\(Def)o(ault:)h(f)o(alse\))p Black 396 2825 a Ft(\225)p -Black 60 w Fq(encoding:)p Fv(Speci\002es)f(the)i(internal)e(encoding)f -(of)i(the)g(parser)-5 b(.)20 b(Most)g(strings)h(are)f(then)f -(represented)g(according)479 2933 y(to)i(this)f(encoding;)f(ho)n(we)n -(v)o(er)f(there)h(are)i(some)f(e)o(xceptions)e(\(especially)i -Fq(ext_id)f Fv(v)n(alues)h(which)g(are)g(al)o(w)o(ays)479 -3041 y(UTF-8)g(encoded\).)e(\(Def)o(ault:)h(`Enc_iso88591\))p -Black 396 3148 a Ft(\225)p Black 60 w Fq -(recognize_standalone_declaration:)c Fv(If)21 b(true)e(and)h(if)h(the)f -(parser)f(is)i(v)n(alidating,)e(the)479 3256 y Fq(standalone="yes")f -Fv(declaration)h(forces)h(that)g(it)h(is)g(check)o(ed)e(whether)g(the)h -(document)e(is)j(a)g(standalone)479 3364 y(document.)d(-)j(If)f(f)o -(alse,)g(or)g(if)g(the)h(parser)e(is)i(in)g(well-formedness)d(mode,)h -(such)h(declarations)f(are)h(ignored.)479 3472 y(\(Def)o(ault:)g -(true\))p Black 396 3580 a Ft(\225)p Black 60 w Fq -(store_element_positions:)d Fv(If)j(true,)g(for)f(e)n(v)o(ery)g -(non-data)f(node)h(the)i(source)e(position)g(is)j(stored.)d(If)h(f)o -(alse,)479 3688 y(the)g(position)g(information)e(is)j(lost.)f(If)g(a)n -(v)n(ailable,)g(you)f(can)h(get)g(the)g(positions)g(of)g(nodes)f(by)h -(in)m(v)n(oking)e(the)479 3796 y Fq(position)i Fv(method.)e(\(Def)o -(ault:)i(true\))p Black 396 3904 a Ft(\225)p Black 60 -w Fq(idref_pass:)p Fv(If)e(true)i(and)g(if)g(there)g(is)h(an)f(ID)h -(inde)o(x,)e(the)h(parser)f(checks)h(whether)f(e)n(v)o(ery)g(IDREF)i -(or)e(IDREFS)479 4012 y(attrib)n(ute)h(refer)g(to)g(an)g(e)o(xisting)f -(node;)h(this)g(requires)g(that)g(the)g(parser)g(tra)n(v)o(erses)g(the) -g(whole)f(doument)g(tree.)h(If)479 4120 y(f)o(alse,)h(this)f(check)g -(is)h(left)f(out.)g(\(Def)o(ault:)g(f)o(alse\))p Black -396 4228 a Ft(\225)p Black 60 w Fq(validate_by_dfa:)p -Fv(If)e(true)h(and)h(if)h(the)f(content)f(model)g(for)h(an)g(element)g -(type)f(is)i(deterministic,)e(a)479 4336 y(deterministic)h(\002nite)g -(automaton)e(is)j(used)f(to)h(v)n(alidate)e(whether)g(the)i(element)e -(contents)h(match)f(the)i(content)479 4444 y(model)e(of)h(the)g(type.)g -(If)g(f)o(alse,)g(or)g(if)g(a)g(DF)-6 b(A)21 b(is)g(not)f(a)n(v)n -(ailable,)f(a)h(backtracking)e(algorithm)g(is)j(used)f(for)f(v)n -(alidation.)479 4552 y(\(Def)o(ault:)h(true\))p Black -396 4659 a Ft(\225)p Black 60 w Fq(accept_only_deterministic_models:)15 -b Fv(If)21 b(true,)e(only)h(deterministic)f(content)g(models)h(are)g -(accepted;)f(if)479 4767 y(f)o(alse,)i(an)o(y)e(syntactically)h -(correct)f(content)g(models)h(can)g(be)g(processed.)f(\(Def)o(ault:)g -(true\))p Black 3800 5278 a Fr(92)p Black eop -%%Page: 93 93 -93 92 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black -2 583 a Fp(4.4.4.)35 -b(Whic)o(h)f(con\002guration)g(should)g(I)f(use?)396 -751 y Fv(First,)21 b(I)f(recommend)e(to)i(v)n(ary)g(the)g(def)o(ault)f -(con\002guration)f(instead)i(of)g(creating)f(a)i(ne)n(w)f -(con\002guration)d(record.)i(F)o(or)396 859 y(instance,)h(to)g(set)h -Fq(idref_pass)e Fv(to)i Fq(true)p Fv(,)e(change)g(the)i(def)o(ault)e -(as)i(in:)396 1039 y Fq(let)45 b(config)e(=)i({)g(default_config)d -(with)i(idref_pass)g(=)g(true)g(})396 1230 y Fv(The)20 -b(background)d(is)k(that)f(I)h(can)f(add)f(more)h(options)f(to)h(the)g -(record)f(in)i(future)e(v)o(ersions)g(of)h(the)g(parser)f(without)396 -1338 y(breaking)g(your)f(programs.)396 1487 y Fu(Do)i(I)i(need)e(extra) -f(nodes)i(f)n(or)f(pr)o(ocessing)g(instructions?)g Fv(By)g(def)o(ault,) -g(such)g(nodes)f(are)h(not)g(created.)f(This)i(does)396 -1595 y(not)f(mean)g(that)g(the)g(processing)f(instructions)g(are)h -(lost;)h(ho)n(we)n(v)o(er)m(,)d(you)h(cannot)g(\002nd)h(out)g(the)g(e)o -(xact)g(location)f(where)396 1703 y(the)o(y)h(occur)-5 -b(.)19 b(F)o(or)h(e)o(xample,)e(the)j(follo)n(wing)d(XML)i(te)o(xt)396 -1883 y Fq()396 2074 y Fv(will)h(normally)e -(create)h(one)f(element)h(node)f(for)h Fq(x)g Fv(containing)e -Fr(one)i Fv(subnode)f(for)g Fq(y)p Fv(.)h(The)g(processing)f -(instructions)396 2182 y(are)h(attached)g(to)g Fq(x)h -Fv(in)f(a)h(separate)e(hash)h(table;)h(you)e(can)h(access)h(them)e -(using)h Fq(x)45 b(#)f(pinstr)g("pi1")20 b Fv(and)g Fq(x)44 -b(#)396 2290 y(pinstr)g("pi2")p Fv(,)20 b(respecti)n(v)o(ely)-5 -b(.)18 b(The)i(information)d(is)k(lost)g(where)f(the)g(instructions)f -(occur)g(within)h Fq(x)p Fv(.)396 2439 y(If)g(the)h(option)d -Fq(enable_pinstr_nodes)g Fv(is)j(turned)e(on,)h(the)g(parser)f(creates) -i(e)o(xtra)e(nodes)g Fq(pi1)i Fv(and)e Fq(pi2)i Fv(such)f(that)396 -2547 y(the)g(subnodes)f(of)h Fq(x)h Fv(are)f(no)n(w:)396 -2728 y Fq(x)45 b(#)g(sub_nodes)e(=)i([)f(pi1;)g(y;)h(pi2)f(])396 -2919 y Fv(The)20 b(e)o(xtra)g(nodes)f(contain)g(the)h(processing)f -(instructions)g(in)i(the)f(usual)g(w)o(ay)-5 b(,)20 b(i.e.)g(you)f(can) -h(access)h(them)f(using)f Fq(pi1)396 3026 y(#)45 b(pinstr)f("pi1")20 -b Fv(and)f Fq(pi2)45 b(#)f(pinstr)g("pi2")p Fv(,)20 b(respecti)n(v)o -(ely)-5 b(.)396 3176 y(Note)20 b(that)h(you)e(will)i(need)e(an)i(e)o(x) -o(emplar)d(for)h(the)i(PI)f(nodes)g(\(see)g Fq(make_spec_from_alist)p -Fv(\).)396 3325 y Fu(Do)g(I)i(need)e(a)h(super)g(r)o(oot)d(node?)i -Fv(By)h(def)o(ault,)e(there)h(is)h(no)f(super)f(root)h(node.)f(The)h -Fq(document)f Fv(object)h(refers)396 3433 y(directly)g(to)g(the)g(node) -f(representing)f(the)j(root)e(element)h(of)g(the)g(document,)e(i.e.)396 -3613 y Fq(doc)45 b(#)f(root)g(=)h(r)396 3804 y Fv(if)21 -b Fq(r)f Fv(is)h(the)g(root)e(node.)g(This)h(is)i(sometimes)d(incon)m -(v)o(enient:)f(\(1\))h(Some)h(algorithms)f(become)g(simpler)h(if)g(e)n -(v)o(ery)f(node)396 3912 y(has)i(a)f(parent,)f(e)n(v)o(en)g(the)i(root) -e(node.)g(\(2\))h(Some)g(standards)f(such)h(as)h(XP)o(ath)f(call)g(the) -h("root)e(node")g(the)h(node)f(whose)396 4020 y(child)h(represents)f -(the)i(root)e(of)h(the)g(document.)e(\(3\))i(The)g(super)f(root)h(node) -f(can)h(serv)o(e)f(as)i(a)g(container)e(for)g(processing)396 -4128 y(instructions)g(outside)h(the)g(root)g(element.)f(Because)i(of)e -(these)i(reasons,)e(it)i(is)g(possible)f(to)h(create)f(an)g(e)o(xtra)f -(super)h(root)396 4236 y(node,)f(whose)h(child)g(is)h(the)f(root)g -(node:)396 4416 y Fq(doc)45 b(#)f(root)g(=)h(sr)403 b(&&)396 -4513 y(sr)45 b(#)f(sub_nodes)g(=)g([)h(r)g(])396 4704 -y Fv(When)20 b(e)o(xtra)g(nodes)f(are)h(also)h(created)e(for)h -(processing)f(instructions,)g(these)h(nodes)f(can)h(be)h(added)e(to)h -(the)g(super)g(root)396 4812 y(node)f(if)h(the)o(y)e(occur)h(outside)g -(the)g(root)g(element)g(\(reason)f(\(3\)\),)h(and)g(the)g(order)g -(re\003ects)g(the)h(order)e(in)i(the)f(source)g(te)o(xt.)p -Black 3800 5278 a Fr(93)p Black eop -%%Page: 94 94 -94 93 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fv(Note)g(that)h(you)e -(will)i(need)e(an)i(e)o(x)o(emplar)d(for)h(the)i(super)e(root)h(node)f -(\(see)h Fq(make_spec_from_alist)p Fv(\).)396 728 y Fu(What)g(is)h(the) -g(effect)e(of)h(the)h(UTF-8)e(encoding?)h Fv(By)h(def)o(ault,)e(the)h -(parser)g(represents)f(strings)h(\(with)g(fe)n(w)396 -836 y(e)o(xceptions\))e(as)j(ISO-8859-1)c(strings.)i(These)h(are)g -(well-kno)n(wn,)d(and)j(there)f(are)h(tools)g(and)f(fonts)g(for)h(this) -g(encoding.)396 986 y(Ho)n(we)n(v)o(er)m(,)e(internationalization)g -(may)h(require)g(that)i(you)e(switch)h(o)o(v)o(er)f(to)i(UTF-8)e -(encoding.)f(In)i(most)396 1094 y(en)m(vironments,)d(the)k(immediate)e -(ef)n(fect)h(will)g(be)h(that)f(you)f(cannot)g(read)h(strings)g(with)g -(character)f(codes)h(>=)h(160)e(an)o(y)396 1202 y(longer;)g(your)g -(terminal)h(will)h(only)e(sho)n(w)h(funn)o(y)e(glyph)h(combinations.)f -(It)i(is)h(strongly)e(recommended)e(to)k(install)396 -1310 y(Unicode)e(fonts)h(\(GNU)g(Unifont)f -(\(http://czyborra.com/unifon)o(t/\),)c(Markus)k(K)o(uhn')-5 -b(s)19 b(fonts)396 1417 y(\(http://www)-5 b(.cl.cam.ac.uk/~mgk25)o(/do) -m(wnlo)o(ad/u)o(cs-fo)o(nts.tar)g(.g)o(z\)\))14 b(and)20 -b(terminal)f(emulators)h(that)g(can)g(handle)396 1525 -y(UTF-8)g(byte)g(sequences)f(\(http://myweb)m(.clark.net/pub/d)o(ick)o -(e)o(y)o(/xter)o(m/x)o(term.)o(html\))o(.)c(Furthermore,)i(a)k(Unicode) -396 1633 y(editor)f(may)f(be)i(helpful)e(\(such)g(as)i(Y)-9 -b(udit)20 b(\(ftp://metalab)m(.unc.edu/pub)o(/Linu)o(x/ap)o(ps/ed)o -(itors/X/\)\))o(.)15 b(There)k(are)h(also)396 1741 y(F)-6 -b(A)h(Q)21 b(\(http://www)-5 b(.cl.cam.ac.uk/~mgk25)o(/unico)o(de)o -(.htm)o(l\))15 b(by)20 b(Markus)f(K)o(uhn.)396 1891 y(By)i(setting)f -Fq(encoding)f Fv(to)i Fq(`Enc_utf8)e Fv(all)i(strings)f(originating)e -(from)h(the)i(parsed)e(XML)h(document)e(are)396 1999 -y(represented)h(as)i(UTF-8)e(strings.)h(This)h(includes)e(not)h(only)f -(character)g(data)h(and)g(attrib)n(ute)g(v)n(alues)g(b)n(ut)g(also)g -(element)396 2107 y(names,)g(attrib)n(ute)g(names)g(and)f(so)i(on,)e -(as)i(it)g(is)g(possible)f(to)h(use)f(an)o(y)f(Unicode)g(letter)i(to)f -(form)f(such)h(names.)g(Strictly)396 2214 y(speaking,)f(PXP)i(is)g -(only)e(XML-compliant)f(if)j(the)f(UTF-8)g(mode)f(is)i(used;)f -(otherwise)g(it)h(will)g(ha)n(v)o(e)e(dif)n(\002culties)396 -2322 y(when)h(v)n(alidating)f(documents)f(containing)g -(non-ISO-8859-1-names.)396 2472 y(This)j(mode)e(does)h(not)g(ha)n(v)o -(e)f(an)o(y)h(impact)f(on)h(the)g(e)o(xternal)f(representation)f(of)i -(documents.)f(The)g(character)g(set)396 2580 y(assumed)h(when)g -(reading)e(a)j(document)d(is)j(set)g(in)g(the)f(XML)g(declaration,)e -(and)i(character)f(set)i(when)e(writing)h(a)396 2688 -y(document)e(must)j(be)f(passed)g(to)g(the)g Fq(write)g -Fv(method.)396 2837 y Fu(Ho)o(w)g(do)h(I)g(check)f(that)g(nodes)h -(exist)f(which)h(ar)o(e)e(r)o(eferr)o(ed)g(by)i(IDREF)g(attrib)n(utes?) -e Fv(First,)i(you)e(must)h(create)g(an)396 2945 y(inde)o(x)f(of)h(all)h -(occurring)d(ID)i(attrib)n(utes:)396 3125 y Fq(let)45 -b(index)f(=)g(new)h(hash_index)396 3316 y Fv(This)21 -b(inde)o(x)e(must)h(be)g(passed)g(to)g(the)h(parsing)e(function:)396 -3496 y Fq(parse_document_entity)486 3593 y(~id_index:\(index)42 -b(:>)j(index\))486 3691 y(config)f(source)g(spec)396 -3882 y Fv(Ne)o(xt,)20 b(you)f(must)h(turn)g(on)g(the)g -Fq(idref_pass)f Fv(mode:)396 4062 y Fq(let)45 b(config)e(=)i({)g -(default_config)d(with)i(idref_pass)g(=)g(true)g(})396 -4253 y Fv(Note)20 b(that)h(no)n(w)e(the)i(whole)e(document)f(tree)j -(will)g(be)f(tra)n(v)o(ersed,)f(and)g(e)n(v)o(ery)g(node)g(will)i(be)f -(check)o(ed)f(for)h(IDREF)g(and)396 4361 y(IDREFS)h(attrib)n(utes.)f -(If)g(the)g(tree)g(is)h(big,)f(this)h(may)f(tak)o(e)g(some)g(time.)396 -4510 y Fu(What)g(ar)o(e)g(deterministic)g(content)g(models?)g -Fv(These)g(type)g(of)g(models)g(can)g(speed)f(up)h(the)g(v)n(alidation) -f(checks;)396 4618 y(furthermore)f(the)o(y)h(ensure)g -(SGML-compatibility)-5 b(.)18 b(In)i(particular)m(,)e(a)j(content)e -(model)g(is)i(deterministic)e(if)i(the)f(parser)396 4726 -y(can)g(determine)f(the)h(actually)g(used)g(alternati)n(v)o(e)f(by)g -(inspecting)g(only)h(the)g(current)f(tok)o(en.)g(F)o(or)h(e)o(xample,)e -(this)396 4834 y(element)i(has)g(non-deterministic)e(contents:)p -Black 3800 5278 a Fr(94)p Black eop -%%Page: 95 95 -95 94 bop Black 2348 67 a Fr(Chapter)20 b(4.)g(Con\002guring)e(and)i -(calling)f(the)h(par)o(ser)p Black 396 579 a Fq()396 770 y Fv(If)20 -b(the)h(\002rst)f(element)g(in)g Fq(x)h Fv(is)g Fq(u)p -Fv(,)f(the)h(parser)e(does)h(not)g(kno)n(w)f(which)h(of)g(the)g -(alternati)n(v)o(es)f Fq(\(u,v\))h Fv(or)g Fq(\(u,y+\))g -Fv(will)396 878 y(w)o(ork;)g(the)g(parser)g(must)g(also)g(inspect)g -(the)h(second)e(element)g(to)i(be)f(able)g(to)g(distinguish)g(between)f -(the)h(alternati)n(v)o(es.)396 986 y(Because)h(such)f(look-ahead)d -(\(or)j("guessing"\))e(is)k(required,)c(this)i(e)o(xample)f(is)i -(non-deterministic.)396 1135 y(The)f(XML)g(standard)f(demands)g(that)i -(content)e(models)g(must)i(be)f(deterministic.)f(So)h(it)h(is)g -(recommended)c(to)k(turn)e(the)396 1243 y(option)g Fq -(accept_only_deterministic_models)d Fv(on;)j(ho)n(we)n(v)o(er)m(,)f -(PXP)j(can)f(also)h(process)e(non-deterministic)396 1351 -y(models)h(using)g(a)g(backtracking)e(algorithm.)396 -1500 y(Deterministic)i(models)g(ensure)f(that)h(v)n(alidation)f(can)h -(be)g(performed)e(in)i(linear)g(time.)g(In)g(order)f(to)h(get)g(the)396 -1608 y(maximum)f(bene\002ts,)h(PXP)h(also)f(implements)f(a)i(special)f -(v)n(alidator)f(that)h(pro\002ts)g(from)f(deterministic)h(models;)f -(this)396 1716 y(is)i(the)g(deterministic)e(\002nite)h(automaton)f -(\(DF)-6 b(A\).)19 b(This)i(v)n(alidator)d(is)k(enabled)d(per)g -(element)h(type)g(if)g(the)g(element)396 1824 y(type)g(has)g(a)h -(deterministic)e(model)h(and)f(if)i(the)f(option)f Fq(validate_by_dfa)f -Fv(is)j(turned)e(on.)396 1974 y(In)h(general,)f(I)h(e)o(xpect)g(that)g -(the)g(DF)-6 b(A)21 b(method)e(is)i(f)o(aster)f(than)g(the)g -(backtracking)e(method;)g(especially)i(in)h(the)f(w)o(orst)396 -2082 y(case)h(the)f(DF)-6 b(A)21 b(tak)o(es)f(only)g(linear)f(time.)i -(Ho)n(we)n(v)o(er)m(,)d(if)i(the)g(content)g(model)f(has)h(only)g(fe)n -(w)g(alternati)n(v)o(es)f(and)h(the)396 2190 y(alternati)n(v)o(es)f(do) -h(not)g(nest,)g(the)h(backtracking)c(algorithm)i(may)g(be)i(better)-5 -b(.)-2 2691 y Fx(4.5.)39 b(Updates)396 2871 y Fr(Some)20 -b(\(often)f(later)i(added\))d(featur)m(es)i(that)g(ar)m(e)h(otherwise)f -(not)g(e)n(xplained)f(in)h(the)h(manual)d(b)n(ut)j(worth)f(to)g(be)396 -2979 y(mentioned.)p Black 396 3211 a Ft(\225)p Black -60 w Fv(Methods)g(node_position,)d(node_path,)g(nth_node,)h(pre)n -(vious_node,)e(ne)o(xt_node)h(for)j(nodes:)f(See)479 -3319 y(pxp_document.mli)p Black 396 3427 a Ft(\225)p -Black 60 w Fv(Functions)h(to)g(determine)f(the)h(document)e(order)h(of) -h(nodes:)f(compare,)g(create_ord_inde)o(x,)c(ord_number)m(,)479 -3535 y(ord_compare:)i(See)k(pxp_document.mli)p Black -3800 5278 a Fr(95)p Black eop -%%Page: 96 96 -96 95 bop Black Black Black Black eop -%%Trailer -end -userdict /end-hook known{end-hook}if -%%EOF